-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
CI: enforce clippy rules in clippy command #3258
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very much in favor of this, it will also make reviewing PRs that introduce new clippy lints so much easier to review because the change set wont be polluted by the addition of warn
attributes.
utils.run_cmd( | ||
"cargo clippy --target {} --all --profile test" " -- -D warnings".format(target) | ||
) | ||
cmd = "cargo clippy --target {} --all --profile test" " --".format(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: make this a single string
also: why do we have to append the "-D warnings" below, can't we include the it here, like it was before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean I should make a single string?
I got it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should include the rules in the code and in the command.
By moving them outside the code, cargo clippy
becomes less useful, it would be required to copy and paste the long form command to test clippy.
Less useful would mean that with this change, we run the risk to uncover less errors. i do not think this is the case, right? Are you maybe saying that it is easier to test |
Instead of polluting the source code with it. Signed-off-by: Diana Popa <[email protected]>
16e7cbb
to
4b90911
Compare
Yes you are right, I did mean that it is easier to use clippy if the warnings are set inside the source code (it will quickly become like |
I feel that by making it easier for integration tests to be run standalone we might be sending the wrong message or encouragement. Another aspect of keeping the Additionally, we should be striving to have in Firecracker source code that does not tie into specificities of deployment or integration testing (for ease of forking). |
Even developing within devtool the integration test is more awkward
At the moment this is awkward due to the number of crates in the workspace, at the moment we have too many separate crates, in the future we should have less crates (this draft PR #3079 reduces the number of crates to 5) and this should decrease the effort of maintaining consistency here. I understand your points here, but I still would argue it is more effort to need to copy and paste a command from an integration test on every PR than to maintain <20 lines of lint specifics in each crate, which will likely rarely need to changed.
I'm not sure I see your point here. |
I agree with @JonathanWoollett-Light here. It should be easy to use tool directly + it would be faster, considering how slow pytest is. [build]
rustflags = ["-Dclippy::print-stdout"] so maybe it would be easier to have all lints in |
iirc the problem with having the lint in |
We can have a |
We internally decided to go ahead with having a clippy.rs at the root then each library can have include!("./clippy.rs") (https://doc.rust-lang.org/std/macro.include.html). |
Changes
Reason
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.
PR Checklist
git commit -s
).unsafe
code is documented.CHANGELOG.md
.rust-vmm
.