-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
configurationRelated to settings and configurationRelated to settings and configurationcoreRelated to core functionalityRelated to core functionalityhelp wantedContributions especially welcomeContributions especially welcome
Description
I'd like a way to activate a rule for a subset of files; basically the inverse of per-file-ignores. In my case, I'd like to activate pydocstyle on the main module, but not tests, examples, docs, benchmarks, support files, setup.py, etc.
Current and possible options:
- Use a second ruff.toml/pyproject.toml inside the package. This is not ideal, as I don't want to add extra files (especially pyproject.toml's, as those should only be at the root of packages). This is the only one in the list that would work today (that I know of).
.ruff.toml(Additional configuration file.ruff.toml#2988) would help a little, but still not my preferred solution for this case - I'd like all configuration in a single file. - Add
tool.ruff.per-file-extend-select(technically,per-file-ignoresis also extend, so maybe for symmetry it could betool.ruff.per-file-extend-select). This would then be"src/**.py" = ["D"]. - Support negation in
tool.ruff.per-file-ignoreslike a gitignore. So"!src/**.py" = ["D"]would ignore D on anything exceptsrc/**.pyfiles.
Thoughts?
Here's what I would have to put without this:
[tool.ruff.per-file-ignores]
"doc/**.py" = ["D"]
"tests/**.py" = ["D"]
"bench/**.py" = ["D"]
".ci/**.py" = ["D"]
"cmake_ext.py" = ["D"]
"version.py" = ["D"]
"setup.py" = ["D"]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
configurationRelated to settings and configurationRelated to settings and configurationcoreRelated to core functionalityRelated to core functionalityhelp wantedContributions especially welcomeContributions especially welcome