You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
per-file-ignore filename globs are respected when running Ruff against . and stdin. However, directory globs are not respected when running Ruff against stdin.
❯ ruff --version
ruff 0.0.220
❯ mkdir ruff-example
❯ cd ruff-example
❯ mkdir tests
❯ echo'import os'> tests/foo.py
❯ ruff --isolated .
tests/foo.py:1:8: F401 `os` imported but unused
Found 1 error(s).
1 potentially fixable with the --fix option.
# so far so good
❌1 ❮ ruff --isolated --per-file-ignores='foo*:F401'.# filename glob match OK!
❯ ruff --isolated --per-file-ignores='tests/*:F401'.# directory glob match OK!
❯ ruff --isolated --per-file-ignores='foo*:F401' --stdin-filename 'tests/foo.py' - < tests/foo.py
# filename glob match OK!
❯ ruff --isolated --per-file-ignores='tests/*:F401' --stdin-filename 'tests/foo.py' - < tests/foo.py
tests/foo.py:1:8: F401 `os` imported but unused
Found 1 error(s).
1 potentially fixable with the --fix option.
# directory glob match not ok
❌1 ❮
Non-basename glob matches (e.g., for `--per-file-ignores`) assume that
the path has been converted to an absolute path. (We do this for
filenames as part of the directory traversal.) For filenames passed via
stdin, though, we're missing this conversion. So `--per-file-ignores`
that rely on the _basename_ worked as expected, but directory paths did
not.
Closes#1840.
per-file-ignore
filename globs are respected when running Ruff against.
and stdin. However, directory globs are not respected when running Ruff against stdin.Related to #1342?
The text was updated successfully, but these errors were encountered: