-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add Clippy baseline to block new complexity and unwrap usage #3555
Description
Context
Our codebase has been around for a while and has grown in complexity. Right now, for Rust code we run cargo clippy with the default rules, but I think we could benefit from enabling some additional lints that specifically flag complexity and error handling issues.
Here are some that I’m considering:
clippy::too_many_lines
clippy::too_many_arguments
clippy::cognitive_complexity
clippy::fn_params_excessive_bools
clippy::type_complexity
clippy::branches_sharing_code
clippy::unwrap_used
Proposal
If we turn on the above rule check, there will be hundreds of violations. Fixing all of them at once would be a very big task. I am thinking about using a baseline file to capture current existing Clippy violations (by file + lint).
CI would then block new violations, but not existing ones.
With this, we can prevents new issues from the new files/changes and then we can fix old issues gradually.