-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add Clippy linter step to CICD #1410
Add Clippy linter step to CICD #1410
Conversation
Run the linter on the minimum supported rust version; otherwise we will get lint warnings for things that require a too high Rust toolchain version to fix. Allow the following checks, since we already violate them our code: - clippy::new-without-default - clippy::match-bool - clippy::if_same_then_else Eventually we should fix these lint issues and then disallow them to prevent them from coming back in other places. The clippy args used is recommended here: https://github.com/rust-lang/rust-clippy#travis-ci
Thank you for you contribution! We just recently fixed a few clippy warnings (#1369), but I'm not 100% convinced we should enforce 0 clippy warnings in CI (see #1369 (comment)). Would this break the build if new clippy warnings are introduced? As there are more people which seem concerned about this, I'm happy to reconsider. |
No, it will just run.. see the build for this PR. |
First of all, I just want to make it clear that I will of course respect whatever decision you make in this matter. I also understand and agree that we do not want to scare contributors away over some coding style or matter-of-taste issue. However:
The current set of clippy checks can be browsed here: https://rust-lang.github.io/rust-clippy/master/ What do you think about the above proposal? (I will create another PR in the near term to fix the last correctness lint we have)
Yes, but
One occasion where we will likely see a big "sudden" set of new lint errors is when we bump
My bad! I somehow managed to not see it even though I looked for it. |
Thank you for the detailed answer. I agree with all of your arguments, so let's enable this 👍 Have you seen https://github.com/actions-rs/clippy-check? Would it be preferable to use that instead of
merged |
Yes and it looks very nice 🤩 But I interpret
to mean that it will not work for PRs that contributors creates, which makes it almost useless IMHO 😞 So I don't think it is worth setting up I'm afraid. I would be super great to have if it worked for PRs, for sure. I'm glad you agree with my proposal! I'll update the PR. |
Only the 'correctness' category of lints are 'deny' by default. This is the only clippy lints we want to enforce for now. The other ones we just want to print in the logs. So remove any --deny and --allow arguments. See discussion in sharkdp#1410.
Run the linter on the minimum supported rust version; otherwise we will
get lint warnings for things that require a too high Rust toolchain
version to fix.
Allow the following warnings, since we already have them our code:
Eventually we should fix these lint issues and then disallow them to
prevent them from coming back in other places.
The clippy args used is recommended here:
https://github.com/rust-lang/rust-clippy#travis-ci
I noticed that my PR #1402 passed CICD checks despite having some lint issues, so I thought it would be a good idea to add a linter step to CICD.
I tested the new step in GitHub Actions over at my fork, and it seems to work. You can check here if you want: https://github.com/Enselic/bat/runs/1467487513?check_suite_focus=true (Please ignore my temp changes to CICD.yml to be able to make the test).
But of course it would be a good idea for you to make sure the new step works when triggered from this repo as well. I think you have to trigger it manually since I don't have permission to trigger new CI/CD steps in this repo (which makes sense for security reasons of course).
(I didn't add anything about this to CHANGELOG.md since the change does not affect the behavior of bat, as touched upon in CONTRIBUTING.md)