Skip to content

ruff format does not support ignore despite explicit instructions to do so #18199

@utdrmac

Description

@utdrmac

Summary

$ ruff --version
ruff 0.11.10

$ ruff format --check .build/mytool.py
warning: The following rule may cause conflicts when used with the formatter: `COM812`. To avoid unexpected behavior, we recommend disabling this rule, either by removing it from the `select` or `extend-select` configuration, or adding it to the `ignore` configuration.

The instructions tell me to add COM812 to the 'ignore' configuration. Sure thing:

$ cat ruff.toml
[lint]
select = ["ALL"]
ignore = ["C901", "D100", "D103", "D203", "D211", "D212"]

[format]
quote-style = "double"

$ ruff format --check .build/mytool.py
ruff failed
  Cause: Failed to load configuration `/path/ruff.toml`
  Cause: Failed to parse /path/ruff.toml
  Cause: TOML parse error at line 3, column 1
  |
3 | ignore = ["COM812"]
  | ^^^^^^
unknown field `ignore`, expected one of `exclude`, `preview`, `indent-style`, `quote-style`, `skip-magic-trailing-comma`, `line-ending`, `docstring-code-format`, `docstring-code-line-length`

Extremely contradictory instructions. Formatter says "do this", I did it, then formatter complains. I'm at a loss.

Please either A) update the warning output to provide proper instructions, or B) add ignore support to ruff.toml for [format] section to match instructions. Because I'm running 'ruff format' it does not make sense to add to the ignore section of [lint]. If I was running 'ruff check', sure, it makes sense (sorta) to add to [lint] section, but I'm running format option, so naturally, it should be added to the [format] section.

Version

0.11.10

Metadata

Metadata

Assignees

Labels

configurationRelated to settings and configurationhelp wantedContributions especially welcome

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions