Rule categorization · Issue #1774 · astral-sh/ruff (original) (raw)
I think there are two perspectives ruff users may have:
- using ruff as a replacement for an existing linter (such as pylint or flake8)
- using ruff from the get-go
The README currently groups rules by their origin. Which I think is suboptimal for both cases. For the first case our README only lists the lints implemented by ruff but doesn't tell you which (or how many) lints ruff is missing. For the second case you don't actually care about where the lints are coming from, you just want to see them grouped by topic.
So I think we should steal a nice feature from Clippy which are lint categories. Clippy has the following categories:
- correctness: code that is outright wrong or useless
- suspicious: code that is most likely wrong or useless
- style: code that should be written in a more idiomatic way
- complexity: code that does something simple but in a complex way
- perf: code that can be written to run faster
- pedantic: lints which are rather strict or have occasional false positives
- nursery: new lints that are still under development
- cargo: lints for the cargo manifest
We could simply use the same categorization (except with cargo instead being pyproject as per #1472). I think we would however need some additional categories since there are several lint categories that Rust does not need, for example:
- syntax: code that is syntactically invalid (syntax errors cannot go by unnoticed in Rust)
- deprecated: functions that have been deprecated (Rust has a
#[deprecated]
macro for that) (see also #1507)
What do you think about this?