ARROW-10952: [Rust] Add pre-commit hook#8953
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8953 +/- ##
=======================================
Coverage 83.25% 83.25%
=======================================
Files 196 196
Lines 48116 48192 +76
=======================================
+ Hits 40059 40124 +65
- Misses 8057 8068 +11
Continue to review full report at Codecov.
|
alamb
left a comment
There was a problem hiding this comment.
I tested this out locally and it worked well for me (MacOS). I typically don't use git commit hooks, but I think this is a nice contribution to assist those who would like to do so.
what do you think @nevi-me / @jorgecarleitao / @andygrove / @Dandandan ?
|
Pre-commit hooks 👍 First thoughts:
|
jorgecarleitao
left a comment
There was a problem hiding this comment.
LGTM. I haven't used git hooks much for Rust, but I think it is a good idea. :) Thanks @mqy for this.
| ``` | ||
|
|
||
| We can use "git pre-commit hook" to automate this process: copy or soft link [pre-commit.sh](pre-commit.sh) | ||
| as file `.git/hooks/pre-commit`. |
There was a problem hiding this comment.
Just to make it dead simple to people less experienced in git, would it be possible to paste the command here? E.g.
cp rust/pre-commit.sh ../.git/hooks/pre-commitor
ln ...There was a problem hiding this comment.
@jorgecarleitao good idea!
I have tried this way but finally aborted.
One of the reason is: one line command for copy/paste is not enough -- if the pre-commit file already exists, copy/link may fail or override them unexpectedly, thus additional check/prompt would make the commands lengthy.
Anyway, let me try again.
I'm glad to add above tasks as our new client side tiny git flow :) Let me try! |
…soft link command
|
Updated. NOTE: /bin/sh was changed to /bin/bash Although I had a few experience on TTY color before, honestly speaking, I'm not quite confident about the color behavior on various shells. Feed back welcome! |
|
I think this is looking good @mqy -- thanks for the doc updates. Given it is an opt in and well documented, I am merging this in and we can iterate in subsequent PRs. |
If a commit contains only fixes for rust format, it would be very sad to wait for the slow CI checking done, and it may block the CI checking for other PRs.
So, this PR adds a git pre-commit hook file, which performs the "cargo fmt --check"