8000 Does ruff ignore private modules? · astral-sh ruff · Discussion #21631 · GitHub
[go: up one dir, main page]

Skip to content
Discussion options

You must be logged in to vote

I suspect this is a behavior of the D1xx rules, not Ruff.

If I have both foo.py and _foo.py that trigger an F401 error, then Ruff reports that in both files:

$ uvx ruff check --isolated --select F .
F401 [*] `os` imported but unused
 --> _foo.py:1:8
  |
1 | import os
  |        ^^
  |
help: Remove unused import: `os`

F401 [*] `os` imported but unused
 --> foo.py:1:8
  |
1 | import os
  |        ^^
  |
help: Remove unused import: `os`

Found 2 errors.
[*] 2 fixable with the `--fix` option.
> [1]

You can confirm what files Ruff is inspecting with the --show-files flag:

$ uvx ruff check --isolated --select F . --show-files
/Users/amethyst/scratch/ruff/_foo.py
/Users/amethyst/scratch/ruff/f…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tazr
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
0