[Tools] Add a git commit hook for clang-format checking
Search before asking
- [X] I had searched in the issues and found no similar issues.
Motivation
Currently our ci checks clang-format. We can add a checking in git hook for that.
Solution
Aadd a checking in git hook for format
Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
I guess we could hard link pre-push.sh to .git/hooks/pre-push during x.py build.
For example:
https://github.com/rust-lang/rust/blob/faefc618cf48bd794cbc808448df1bf3f59f36af/src/bootstrap/src/core/build_steps/setup.rs#L511-L522
However, I'm unsure about the directory in the project where the pre-push.sh source code should be placed.
If convenient, you can add other checks at the same time, such as golang format, clang tidy
However, I'm unsure about the directory in the project where the pre-push.sh source code should be placed.
At root or some build scripts might be ok
clang tidy
clang-tidy is time-consuming, I guess puting it at ci or by-user is better
/assign