kvrocks icon indicating copy to clipboard operation
kvrocks copied to clipboard

[Tools] Add a git commit hook for clang-format checking

Open mapleFU opened this issue 1 year ago • 3 comments

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!

mapleFU avatar May 07 '24 16:05 mapleFU

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.

JoverZhang avatar May 08 '24 00:05 JoverZhang

If convenient, you can add other checks at the same time, such as golang format, clang tidy

PokIsemaine avatar May 08 '24 10:05 PokIsemaine

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

mapleFU avatar May 11 '24 16:05 mapleFU

/assign

PokIsemaine avatar Jun 08 '24 15:06 PokIsemaine