Including rules in extend-select
does not work but including them in select
works.
#12345
-
I recently came across a problem where my Ruff configuration was not using isort. After doing some investigation, I realized that I needed to change the # Before
[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["E4", "E7", "E9", "F"]
ignore = []
extend-select = ["I"]
# After
[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["E4", "E7", "E9", "F", "I"] I came across this other question here (#10753) which led me to the documentation (https://docs.astral.sh/ruff/linter/#rule-selection). What's confusing me is shouldn't both configurations work identically? Or is |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
That should work (https://play.ruff.rs/f19993ec-ee4e-42c4-b92a-cd7c976bf1de), I tested it locally as well using |
Beta Was this translation helpful? Give feedback.
-
I'm currently using Ruff as a pre-commit hook. Pre-commit is being installed using Poetry. I'm also a little confused as to what the problem was, or if the solution actually is changing the options or was something else. If it's certain that both of the code samples above should work identically, I believe it would be safe to close this question. |
Beta Was this translation helpful? Give feedback.
This seems to be working for me. I've uploaded a zip file which contains a
ruff.toml
,test.py
, and a.pre-commit-config.yaml
.Repro: mre.zip
Running
pre-commit run --all-files
would sort the imports intest.py
and the config uses theextend-select
key to includeI
rule.