-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fixes #660 - Add pre-commit hooks #663
Fixes #660 - Add pre-commit hooks #663
Conversation
Codecov Report
@@ Coverage Diff @@
## main #663 +/- ##
=======================================
Coverage 25.90% 25.90%
=======================================
Files 128 128
Lines 31195 31195
Branches 4973 4973
=======================================
Hits 8081 8081
Misses 22059 22059
Partials 1055 1055
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
59c6921
to
b3f84c2
Compare
b3f84c2
to
a7cfe79
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.
This doesn't work the way I'd expect - maybe I don't understand how to use it.
I've installed pre-commit and git-clang-format via dnf.
I've modified message.c to introduce format errors. I then commit message.c.... and it commits without error.
I had expected the commit to fail due to the format errors but it did not.
Ideally we want to flag the error in a way that it's impossible to ignore... and commit upstream.
Also: can cmake check that git-clang-format and per-commit are installed and fail if not? Treat them as required for the build?
Did you do |
That's it: I missed that part. Now when I attempt to commit a bad format I get: ]$ git commit -am "debug: do not merge"
ERROR: you need to run git clang-format on your commit The nice thing is that it already fixed the file locally. All I needed was to re-run the commit and it succeeded. |
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.
Works well, thanks.
a7cfe79
to
399cfa5
Compare
Here's how this fails in CI, https://github.com/skupperproject/skupper-router/runs/7690658958?check_suite_focus=true#step:4:11
You can skip hooks by either not installing them (see below) or by doing
git commit --no-verify
.Here's how this fails locally, when hooks are installed
For local usage, it is necessary to install the pre-commit hook first, by running