namhyung / uftrace

Function graph tracer for C/C++/Rust/Python
https://uftrace.github.io/slide/
GNU General Public License v2.0
2.99k stars 431 forks source link

Add guide of git-clang-format install & quick usage #1721

Closed paranlee closed 1 year ago

paranlee commented 1 year ago

We have used prehook. There are clang-format stage.

In my opinion, It would be nice to have something on the guide about preparing for git-clang-format. I think this way of format checking is more faster to developer. :) like Linux Kernel scripts/checkpatch.pl

I tested with my rpi4.

sudo apt install clang-format -y
# https://github.com/nodesource/distributions#using-ubuntu-2
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
sudo npm install -g clang-format
# not commited
git-clang-format --diff -v
# commited
git-clang-format HEAD~1
namhyung commented 1 year ago

I'm not sure if it's covered by the pre-commit already. @honggyukim ?

honggyukim commented 1 year ago

I think we better not to provide this way. It’s because we can use the same clang-format version under pre-commit but there is no way to set the same version with manual installation. If the clang-format is different then it could possibly apply different coding style.