Open
Description
Description
I am trying to enable fix-only
for some directories and not for others, while running ruff check .
in the repo root directory.
Ruff fix-only
config option doesn't seem to use the 'closest' config file for each individual file.
https://docs.astral.sh/ruff/configuration/#config-file-discovery
$ ruff --version
ruff 0.9.3
├── foo
│ ├── bar.py
│ └── pyproject.toml
└── pyproject.toml
pyproject.toml
:
[tool.ruff]
lint.select = ["F"]
foo/pyproject.toml
:
[tool.ruff]
extend = "../pyproject.toml"
fix-only = true
foo/bar.py
:
import os
from __future__ import annotations
When running ruff check from the root directory here, I expect it to use
fix-onlyfrom
foo/pyproject.tomlsince it's the closest config file to
foo/bar.py` but it doesn't.
$ ruff check .
foo/bar.py:1:8: F401 [*] `os` imported but unused
|
1 | import os
| ^^ F401
2 |
3 | from __future__ import annotations
|
= help: Remove unused import: `os`
foo/bar.py:3:1: F404 `from __future__` imports must occur at the beginning of the file
|
1 | import os
2 |
3 | from __future__ import annotations
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F404
|
Found 2 errors.
[*] 1 fixable with the `--fix` option.
When running from the directory foo, the same command respects fix-only
from foo/pyproject.toml
.
$ ruff check .
Fixed 1 error.
Activity