Ruff does not respect configurations to exclude certain directories #5857
-
So, our current project follows a directory structure like this:
We don't want [tool.ruff]
extend-select = ["D", "I", "RUF"]
ignore = ["D211", "D212"]
extend-exclude = ["migrations"] But |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Hi, thanks for using Ruff and opening the discussion. Is the
|
Beta Was this translation helpful? Give feedback.
Hey, thanks for being patience. I found the problem. The way
null-ls
invokes Ruff is through the stdin interface i.e., it passes the content via stdin and uses the buffer name in the--stdin-filename
. So,null-ls
is invoking Ruff using the command:ruff check -n -e --stdin-filename /home/user/project/migrations/env.py -`
Here, Ruff won't respect the
exclude
(andextend-exclude
) option when an explicit path is passed to it. This is intentional and matches the behavior ofblack
.The solution is to pass the
--force-exclude
flag to force Ruff to respect those options. This is not done bynull-ls
:https://github.com/jose-elias-alvarez/null-ls.nvim/blob/db09b6c691def0038c456551e4e2772186449f35/…