-
Notifications
You must be signed in to change notification settings - Fork 7
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
Adding cargo fix to pre-commit hook #488
Conversation
Thanks for the detailed description @gianfra-t. Although it's just a draft it might have been best to either add all 'devs' as reviewers or ping them in the comments so that this PR doesn't get missed. About the changes itself, you mention that you are not convinced about the results. What would you consider a dealbreaker here? I agree it's not ideal that apparently it's not possible to run clippy only on the modified files but I think it's fine if it's also run on files that were not modified. Eventually all Rust files in the project should adhere to the same formatting. And your suggestion to add this to a 'pre-push' hook sounds reasonable. |
At least in my computer it just takes a LOT of time for each commit, and I think it may be a bit annoying. To be honest, I would not really activate this hook as is. But I guess it is a matter of personal preference! Let me know if you prefer to try this as is, or attempt the pre-push alternative. |
I also think that pre-push is the better solution. |
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.
Let's try a pre-push script then, I tested it locally now and can confirm that it can take quite a while.
656c169
to
9a4dce9
Compare
9a4dce9
to
22393b3
Compare
346b384
to
325079f
Compare
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.
Can you please also update the README file
I assume that .maintain/add-prepush-hook.sh
needs to be run manually once? Can you please also add this to the README?
Co-authored-by: Marcel Ebert <[email protected]>
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.
Looking great, thanks 👍
Regarding #153
We add the following command to a new pre-push hook:
cargo clippy --all-features -- -W clippy::all -A clippy::style -A clippy::forget_copy -A clippy::forget_ref
The expected behavior is that the push will fail if an error is found during the check.
Since this command is also run in our CI, this can save some time and avoid waiting for a build that will fail.
Ignoring the check
It is possible to run
git push --no-verify
to avoid running the new hook.