-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Ignore specific rule on per file basis via in-file comment #2446
Comments
I suspect |
You can always turn off the |
That is correct. I‘m working on a django app, which, as explained earlier, encapsulates a physics based model. So here N803 and friends should be off as upper-case conveys meaning, but in general we like the idea of keeping things lower-case in all other apps in general. Also for this specific project, the .toml is managed by the repo owner, many people contributing apps. And we have pre-commit hooks in place which prevent you from pushing changes to config files. Of course I could ask for a change or force-commit, I was just thinking why not make #ruff: noqa more fine-grained, would be the perfect match for my use-case. |
Flake8 intentionally doesn't support this IIUC. Clippy (Rust's linter) does support something like it although their system is very powerful and effectively allows you to turn rules on and off in any scope. |
It seems that the |
Yes, you can use |
I know we can ignore specific files per toml (
per-file-ignores
) and we can also ignore the whole file by putting# ruff: noqa
at the top of the file. Also I can do--extend-ignore=<rule>
.But how about if I want to ignore only one specifc rule in this file?
The first solution per toml file is not possible for my workflow, the last one does not help with a --pre-commit huck. Would it be possible to allow for it via the in-line comment alla
# ruff: noqa: N803
.Background, I am programming a physics based model and N803 is giving me hell, as we use capital variables because they do have commonly understood physical meaning (t for time and T for temperature).
The text was updated successfully, but these errors were encountered: