-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Roadmap] Lint groups #6626
Comments
flip1995@fa539c9 is a first attempt at implementing this as a PoC. Output for Clippy
|
Add suspicious group changelog: Introduce `clippy::suspicious` 🤔 group and move several lints into the group Closes #6366. CC #6626. A number of lints are moved from each of `correctness`, `style` and `complexity` groups. Notably I didn't move `suspicious_splitn` since I think that is a `correctness` lint despite the name. Lints moved to `clippy::suspicious`: * `blanket_clippy_restriction_lints` (was `clippy::style`) * `empty_loop` (was `clippy::style`) * `eval_order_dependence` (was `clippy::complexity`) * `float_equality_without_abs` (was `clippy::correctness`) * `for_loops_over_fallibles` (was `clippy::correctness`) * `misrefactored_assign_op` (was `clippy::complexity`) * `mut_range_bound` (was `clippy::complexity`) * `mutable_key_type` (was `clippy::correctness`) * `suspicious_arithmetic_impl` (was `clippy::correctness`) * `suspicious_assignment_formatting` (was `clippy::style`) * `suspicious_else_formatting` (was `clippy::style`) * `suspicious_map` (was `clippy::complexity`) * `suspicious_op_assign_impl` (was `clippy::correctness`) * `suspicious_unary_op_formatting` (was `clippy::style`)
Notes on existing groups:
I only looked at lints starting NotesThe following lint sub-categories occur in multiple groups:
Both "Style" is an odd mix of lints. Possibly simply some lints here are mis-categorised. There is also significant divide between lints which concern redundant stuff and lints which concern complexity, with other lints suggesting "more readable" alternatives. "Utility" lints (from multiple groups) do nothing unless specific configuration is added, therefore they should be at least "warn" level by default; these could be placed in a new group. Special sub-categories:
I tried to take an un-biased view on these categories, though certainly do have opinions (e.g. Suggestions and questionsIs a simple list of groups enough? Would hierarchical groups or non-exclusive categories (as in Venn diagram) be better? Is introducing more categories an issue, e.g. because people use config like Some lints are strongly related, e.g. Potentially new categories:
Possibly mis-categorised lints:
|
My 2¢ on this:
|
Regarding
I guess so, though sometimes the why eludes me. E.g. why are A few of those from above are a little hard to place:
|
Lint groups are just assigned by whatever the author + reviewer think is the best group. We try to find the best group, but sometimes some lints might slip through into the arguably wrong group. If you think a lint should be moved to a different group, it is as easy as changing the group in the lint definition and running I don't think we will introduce non-exclusive groups in Clippy. The groups we have need to stay, as they were defined in an RFC. Additional groups that might overlap (with existing groups) will just make configuring lints confusing. Sub-groups maybe. (I brought this up for |
There are more and more issues about managing lints in Clippy popping up. Lints
are hard to implement with a guarantee of no/few false positives (FPs). One way
to address this might be to introduce more lint groups to give users the ability
to better manage lints, or improve the process of classifying lints, so that
disabling lints due to FPs becomes rare. It is important to note, that Clippy
lints are less conservative than
rustc
lints, which won't change in thefuture.
suspicious
group)Steps to completion:
suspicious
lint groupexpect
attribute (Tracking issue for RFC 2383, "Lint Reasons RFC" rust#54503)The text was updated successfully, but these errors were encountered: