Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file discovery incorrectly includes parent config #8858

Closed
bersbersbers opened this issue Nov 27, 2023 · 1 comment · Fixed by #8864
Closed

Config file discovery incorrectly includes parent config #8858

bersbersbers opened this issue Nov 27, 2023 · 1 comment · Fixed by #8864
Assignees
Labels
bug Something isn't working

Comments

@bersbersbers
Copy link
Contributor

bersbersbers commented Nov 27, 2023

The docs read:

"any parent configuration files are ignored"

with a few exceptions, all of which do not apply in the following example (both files have a [tool.ruff] section, --config is not used, a config file is found in the filesystem hierarchy, and nothing is provided on the command line at all).

Still,

mkdir -p bug1/bug2
echo '[tool.ruff]' > bug1/pyproject.toml
echo 'select = ["ALL"]' >> bug1/pyproject.toml
echo '[tool.ruff]' > bug1/bug2/pyproject.toml
echo 'ignore = ["D203", "D212"]' >> bug1/bug2/pyproject.toml
cd bug1/bug2
ruff .

gives

warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `one-blank-line-before-class`.
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.

although one of each pair of rules is clearly disabled in bug1/bug2/pyproject.toml.

rm ../pyproject.toml 
ruff .

works fine, suggesting that the presence of the parent config does play a role although it should not.

ruff 0.1.5

@zanieb
Copy link
Member

zanieb commented Nov 27, 2023

Thanks for the clear reproduction. This is surprising...

Here's the verbose output:

❯ ruff check . --no-cache --verbose
[ruff_cli::resolve][DEBUG] Using configuration file (via parent) at: /repro/bug1/bug2/pyproject.toml
warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `one-blank-line-before-class`.
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.
[ruff_workspace::resolver][DEBUG] Included path via `include`: "/repro/bug1/bug2/pyproject.toml"
[ruff_workspace::resolver][DEBUG] Ignored path via `exclude`: "/repro/bug1/bug2/.ruff_cache"
[ruff_cli::commands::check][DEBUG] Identified files to lint in: 13.826167ms
[ruff_cli::diagnostics][DEBUG] Checking: /repro/bug1/bug2/pyproject.toml
[ruff_cli::commands::check][DEBUG] Checked 1 files in: 3.359583ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants