Modifying the `Ruff: Exclude` settings overrides any exclusions in ruff.toml
hjhicks opened this issue · 3 comments
Environment:
OS: Windows 10
Python version: 3.11.6
Ruff version: 0.5.5
Extension version: v2024.36.0
It appears that when I try to exclude a file or directory through the extension (using Ruff:Exclude
), Ruff forgets about anything that was excluded in ruff.toml
. See below:
Contents of ruff.toml
:
exclude = ["excluded_in_config.py"]
line-length = 10
[lint]
select = ["E"]
ignore = []
[format]
quote-style = "single"
indent-style = "space"
Contents of both excluded_in_config.py
and excluded_in_extension.py
:
def this_will_be_too_long():
pass
Steps to reproduce:
- Create
ruff.toml
,excluded_in_config.py
, andexcluded_in_extension.py
using the above code snippets - In extension settings, set
Ruff:Configuration
to useruff.toml
. Notice thatexcluded_in_config.py
has been properly excluded while Ruff notes a problem inexcluded_in_extension.py
. - Add
excluded_in_extension.py
toRuff:Exclude
. Notice that now,excluded_in_extension.py
has properly been excluded butexcluded_in_config.py
now has errors according to Ruff, despite it being excluded inruff.toml
. This occurs with anything that is excluded inruff.toml
.
Is the Ruff:Exclude
setting intended to override any excludes in ruff.toml
?
Hey, thanks for providing all the details.
Is the
Ruff:Exclude
setting intended to override any excludes inruff.toml
?
Yes, that's the semantics of the exclude
setting. If you'd like to extend it, you need to use extend-exclude
in your ruff.toml
file.
Oh, I see. I didn't know about extend-exclude
. Using that in my ruff.toml
file has solved the issue. Sorry for the trouble and thanks for the help!
No worries, happy to help :)