Skip to content

Ruff does not respect configurations to exclude certain directories #5857

Answered by dhruvmanila
Jarmos-san asked this question in Q&A
Discussion options

You must be logged in to vote

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 (and extend-exclude) option when an explicit path is passed to it. This is intentional and matches the behavior of black.

The solution is to pass the --force-exclude flag to force Ruff to respect those options. This is not done by null-ls:

https://github.com/jose-elias-alvarez/null-ls.nvim/blob/db09b6c691def0038c456551e4e2772186449f35/…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@Jarmos-san
Comment options

@dhruvmanila
Comment options

@Jarmos-san
Comment options

@dhruvmanila
Comment options

Answer selected by Jarmos-san
@Jarmos-san
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants