New lint: missing_workspace_lints#15092
New lint: missing_workspace_lints#15092BenjaminBrienen wants to merge 1 commit intorust-lang:masterfrom
missing_workspace_lints#15092Conversation
|
rustbot has assigned @samueltardieu. Use |
1e4b341 to
9ecf6da
Compare
9ecf6da to
9d20899
Compare
|
I think this should be a Cargo lint instead. "lints" are probably not the only key which should be checked, for example |
r? @llogiq |
|
Clippy already has a few cargo lints and I think it even checks for missing basic metadata (allow by default). If they get moved into cargo itself, this could move with them? |
|
Dear contributor. Clippy has entered a feature freeze period and will not be integrating new lints for a few weeks. You can rest assured that the Clippy team will review and discuss your proposal at the end of the feature freeze period. If you wish to contribute to Clippy in the meantime, do not hesitate to read the pinned tracking issue about the feature freeze itself. @rustbot label +A-lint +S-blocked -S-waiting-on-review |
|
@rustbot note remove "Feature freeze" |
|
With Cargo's linting system being developed, I thought there was a pause on adding new cargo lints to clippy. rust-lang/cargo#15579 is the issue for the Cargo lint. |
Note that this was developed during RustWeek's workshop, before we discussed Clippy/cargo linting. Indeed, if a similar Cargo lint is ongoing, this should be added there instead. |
|
I can understand this being developed days before that conversation but we are now almost a year out from that and this is unmerged. imo we should not merge any more |
|
Agreed (from the start) |
|
Closing as moot now that cargo lints are a thing. |
Fixes rust-lang#15579 Some naming inspiration from rust-lang/rust-clippy#15092. There are several ways to go with this lint and I'm leaving the final decisions to the stabilization conversations. - Could be called `missing_lints` but that makes it sound like its needed even when there is no `workspace.lints` - The name implies it should lint for an empty `[lints]` - Naming to be specific enough is hard - We could lint on a `[lints]` without `workspace = true` but then they will have to turn this lint to `allow` when intentionally not inheriting, adding boilerplate, while we're mainly trying to cover the case of people thinking implicit inheritance is a thing.
Fixes rust-lang#15579 Some naming inspiration from rust-lang/rust-clippy#15092. There are several ways to go with this lint and I'm leaving the final decisions to the stabilization conversations. - Could be called `missing_lints` but that makes it sound like its needed even when there is no `workspace.lints` - The name implies it should lint for an empty `[lints]` - Naming to be specific enough is hard - We could lint on a `[lints]` without `workspace = true` but then they will have to turn this lint to `allow` when intentionally not inheriting, adding boilerplate, while we're mainly trying to cover the case of people thinking implicit inheritance is a thing.
### What does this PR try to resolve? Fixes #15579 ### How to test and review this PR? Some naming inspiration from rust-lang/rust-clippy#15092. There are several ways to go with this lint and I'm leaving the final decisions to the stabilization conversations. - Could be called `missing_lints` but that makes it sound like its needed even when there is no `workspace.lints` - The name implies it should lint for an empty `[lints]` - Naming to be specific enough is hard - We could lint on a `[lints]` without `workspace = true` but then they will have to turn this lint to `allow` when intentionally not inheriting, adding boilerplate, while we're mainly trying to cover the case of people thinking implicit inheritance is a thing.
Adds a new lint for when your workspace has a lint configuration table, but a member of the workspace implicitly does not inherit that configuration. This has bitten me in the butt many times in my large workspace with many crates where I forget to add
lints.workspace = true.Example in rust-analyzer!
Worked on with @NateD-MSFT during the RustWeek workshop.
changelog: [
missing_workspace_lints]: Added new lint to warn when a project is in a workspace with workspace lint configuration, but has not explicitly configuredlints.workspace.