Skip to content

Fix Ruff test-bad-syntax exclusion#697

Merged
henryiii merged 1 commit intopypa:mainfrom
MichaReiser:fix-ruff-config
Oct 26, 2023
Merged

Fix Ruff test-bad-syntax exclusion#697
henryiii merged 1 commit intopypa:mainfrom
MichaReiser:fix-ruff-config

Conversation

@MichaReiser
Copy link
Contributor

This PR fixes ruff check . which started failing with after moving the exclude to [ruff.lint]

ruff failed
  Cause: TOML parse error at line 2, column 19
  |
2 | requires = ['bad' 'syntax']
  |                   ^
invalid array
expected `]`

ruff.exclude and ruff.lint.exclude have slightly different semantics:

  • ruff.exclude: Excludes files from your project, so that ruff skips them for all commands. This also prevents ruff from loading configuration files in excluded directories.
  • ruff.lint.exclude: Excludes files from linting only. However, ruff loads the files (and related configurations).

You want ruff.lint.exclude to avoid the intentionally malformed configuration.

Question: Could we improve our documentation to make this distinction more clear?

Test Plan

ruff check . no longer fails because of the malformed configuration.

@henryiii henryiii merged commit 8b3155d into pypa:main Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants