I am currently playing a bit with clang-format
and clang-tidy
for my teaching. At some point I stumbled on #1552 (closed) and I wrote this (very little) MR to let you know how easy it is to use it.
Basically, I just add a .clang-format
written by @pwithnall (see .clang-format
).
Then, I use this git hook (also mentioned in #1552 (closed)) as follow:
#> git clone https://github.com/barisione/clang-format-hooks.git
#> mkdir .git/scripts/
#> cp clang-format-hooks/apply-format .git/scripts/
#> cp clang-format-hooks/git-pre-commit-format .git/scripts/
#> .git/scripts/git-pre-commit-format install
#> rm -fr clang-format-hooks/
And, it works... Nothing more to add.
I am not sure this will be useful to anybody else, but it captures quite a lot of stupid errors I do a lot (forgetting space between function name and the left parenthesis, wrong indent, ...). So, it seems to be extremely useful (at least to me).
Related to issue #1552 (closed)