ruff: Warnings about incompatible rules with `--select ALL`

I’d rather not see warnings about incompatible rules with --select ALL. Do the following warnings about incompatible rules appear by default on purpose with --select ALL?

  • """Documentation."""
    
  • $ ruff --isolated --select ALL file.py
    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 --version
    ruff 0.1.3
    

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 6
  • Comments: 18 (17 by maintainers)

Most upvoted comments

I do think we could consider removing these rules from ALL.

@nm-remarkable

I just tried

[tool.ruff]
line-length = 120

# Supported rules https://github.com/charliermarsh/ruff/#supported-rules
lint.select = ["ALL"]

lint.ignore = [
    "ANN",    # flake8-annotations: Allow untyped code
    "E501",   # Line lenght higher than 88 characters
    "D",      # pydocstyle: Allow undocummented code
]

lint.pydocstyle.convention = "google"

(with or without the pydocstyle.convention line) and I’m unable to reproduce. Could you open a new issue and provide more details (full ruff configuration, what ruff version are you using)

We have over a million lines of code and currently use ALL and disable about 40 rules (0.1.5 without preview). Without the ALL would we need to explicitly enable all 700 something rules? Enable all the categories, then specify individual ones we want disabled? That seems like it would get awkward? Or maybe I’m just selecting them wrong as it is?

I think many of the formatters and linters (maybe to a lesser extent) are going to be somewhat opinionated. I’m ok with that provided there is a reasonable amount of flexibility to alter the behavior to suit my projects. Maybe in addition to ALL add a DEFAULT which is a curated selection and chooses or disables rules with conflicts. Or possibly something like a --select-conflict-defaults which allows to specify which rules are enabled in case of conflicts.

I don’t have a strong preference on removal from ALL but find excluding rules from ALL a weird pattern.

I’d rather close in favor of https://github.com/astral-sh/ruff/issues/1774

It makes sense. However, newcomers who start with ruff check --help see:

$ ruff check -h
Run Ruff on the given files or directories (default)
[...]
Rule selection:
      --select <RULE_CODE>
          Comma-separated list of rule codes to enable (or ALL, to enable all rules)
      --ignore <RULE_CODE>
          Comma-separated list of rule codes to disable
[...]

If you don’t want the warnings, I’d recommend explicitly ignoring two of those rules (whichever you do not want). In general, we do not recommend usage of --select ALL.