Wondering if there's a way for ruff to exclude a rule on certain files
Ryang20718 opened this issue · comments
First off, want to say <3 this linter.
I was wondering if there's a way to exclude running a rule on a certain file type in ruff.toml
. If this feature isn't present, that's totally fine!
Main use case for us is we have a lot of init.py files with bazel that import libraries, but don't necessarily end up being used (from the linter's perspective due to rust python bindings). We'd like to lint these files, for all other rules, but not f401.
You are probably looking for the per-file-ignores setting.
You can add something like that to your pyproject.toml
file:
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
👍 per-file-ignores
is the recommended solution here!