ci: add clippy rules back to cli call#5953
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5953 +/- ##
=======================================
Coverage 82.8% 82.8%
=======================================
Files 830 830
Lines 377289 377289
=======================================
+ Hits 312526 312603 +77
+ Misses 64763 64686 -77 🚀 New features to boost your workflow:
|
|
This is still going to miss a bunch of stuff. Our current configuration is pretty close to correct, but we need to call something like in the workspace root. At current master it catches this many things it can autofix with --fix: There is way more it can not autofix of course. |
| "+${rust_nightly}" clippy \ | ||
| --workspace --all-targets --features dummy-for-ci-check,frozen-abi | ||
| --workspace --all-targets --features dummy-for-ci-check,frozen-abi -- \ | ||
| --deny=warnings \ |
There was a problem hiding this comment.
when we had these in clippy.toml, did they apply to all workspaces? agreed that putting them in Cargo.toml is pretty unmaintainable so long as we have multiple workspaces in the monorepo
There was a problem hiding this comment.
Keeping them in sync is a matter of a grep checking for relevant section in cargo.toml, no?
There was a problem hiding this comment.
if I don't miss anything, clippy.toml couldn't do that. for allowing/denying lints, we can only do either
- embedded in code
- cli flags
- Cargo.toml
ref: https://doc.rust-lang.org/clippy/configuration.html#allowingdenying-lints
There was a problem hiding this comment.
yes this is correct, we either do CLI flags (which is not ideal as it prevents simply running cargo +nightly clippy during development as you have to call the script which will set all the CLAs for you) or we make sure crates inherit main config correctly. I'd prefer crates inheriting correctly from workspace.
There was a problem hiding this comment.
files=`find . -name "Cargo.toml" `
for file in $files; do
if ! grep -q "^\[lints\]" "$file"; then
echo "Lints missing in $file"
#echo -e "\n[lints]\nworkspace = true" >> "$file"
#echo "Added [lints] to $file"
# maybe call cargo sort here?
else
echo "$file already has [lints]"
fi
doneThere was a problem hiding this comment.
I prefer not to rely on Cargo.toml if we don’t have CI to ensure the rules are consistent in this repo and to enforce that newly added crates include lints.workspace = true
There was a problem hiding this comment.
plug that shell script above into CI?
There was a problem hiding this comment.
I’m happy to do improvements in separate PRs. for this PR, I would like to focus on reverting the lint checks back to how they were before.
There was a problem hiding this comment.
Keeping them in sync is a matter of a grep checking for relevant section in cargo.toml, no?
we want fewer, not more, rube goldberg machines
Problem
we moved the clippy rules from the cli call to
clippy.tomlin #5673, then moved the rule again to the workspace (Cargo.toml) in #5710. however, it caused some issues:1. worksapce lints don't apply to all crates by default
we will need to add something like
to get crates follow the clippy rule. unfortunately, we already had something sneak into master. you can check the build from the first commit in this PR: https://buildkite.com/anza/agave/builds/22874#0196663a-0a7b-4a56-801a-b0b624917fed.
2. multiple workspaces in agave
for now, we have several different workspaces in Agave. if we want all of them to follow the same rules as before, we’ll need to copy the rules into each one. maintaining consistency will likely become an issue in the future.
Summary of Changes
note: part of #5952