[Suggestion] More Restrictive Lint Levels
kevinmatthes opened this issue ยท 8 comments
Clippy shall ensure a good code quality. However, the default configuration does not catch all mistakes such that a more restrictive setup would be useful. I would like to suggest to configure Clippy to be more restrictive. Therefore, one just needs to add the desired lint levels to a crate's root, i.e. src/main.rs
, here.
My preferred setup is the following:
#![deny( // Basic setup with the most important lint levels.
clippy::all,
clippy::cargo,
clippy::complexity,
clippy::correctness,
clippy::nursery,
clippy::pedantic,
clippy::perf,
clippy::suspicious,
clippy::style,
deprecated,
missing_docs,
rustdoc::broken_intra_doc_links
)]
#![allow(clippy::multiple_crate_versions)] // Do not reject Clap's dependencies as implied by `clippy::cargo`.
@tobealive, which lint levels would you prefer to add?
I like that. I was about to add more strictness to the action runs. But I thought if Clippy yelled that much, it would be nasty, especially for new contributors. Having those right away at compile time would be great.
This level of strictness will probably require quite a bit of change. And we would need to remove things like missing_docs. If you want to add this setup and the changes suggested by clippy, go for it :)!
Okay, I will prepare a PR with the initial setup. I will add the suggestion from the initial comment on this issue as it is despite commenting out the missing_docs
. I will also take care for the necessary changes due to the more restrictive lints.
When adding the very restrictive Clippy lints, there were about 200 errors. I already resolved the half of them. It might take a while to also resolve the others. I will submit the resolved code by the end of the next week.
I will prepare a PR based on the changes in #106 as soon as it is merged.
Clippy shall ensure a good code quality. However, the default configuration does not catch all mistakes such that a more restrictive setup would be useful. I would like to suggest to configure Clippy to be more restrictive. Therefore, one just needs to add the desired lint levels to a crate's root, i.e.
src/main.rs
, here.My preferred setup is the following:
#![deny( // Basic setup with the most important lint levels. clippy::all, clippy::cargo, clippy::complexity, clippy::correctness, clippy::nursery, clippy::pedantic, clippy::perf, clippy::suspicious, clippy::style, deprecated, missing_docs, rustdoc::broken_intra_doc_links )] #![allow(clippy::multiple_crate_versions)] // Do not reject Clap's dependencies as implied by `clippy::cargo`.@tobealive, which lint levels would you prefer to add?
some of these are redundant, no?
clippy::all
is an alias for correctness, suspicious, style, complexity, and perf.
The other piece of advice I would give is if you're using such restrictive lints, then I would strongly consider pinning the clippy version used in CI to prevent PRs from having errors which are from new lints and not related to the changed code
Thank you for your feedback, @danieleades! I will take your comments into account when preparing the PR.
@danieleades introduced a very good basic setup regarding more restrictive lint levels in #106. As there is nothing more to add to that basic configuration, I will close this issue as completed.