1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-09 21:30:42 +00:00

Add pre-commit hook clang-format example

Regards https://github.com/profanity-im/profanity/issues/1396
This commit is contained in:
Michael Vetter 2020-07-07 09:51:47 +02:00
parent 9b55f2dec0
commit 1bbb819dac

View File

@ -8,6 +8,17 @@ You'll need to have `clang-format` installed.
Then just run `make format` before you do any commit.
It might be a good idea to add a git pre-commit hook.
So git automatically runs clang-format before doing a commit.
You can add the following snippet to `.git/hooks/pre-commit`:
```
for f in $(git diff --cached --name-only)
do
clang-format -i $f
done
```
## Pull Requests
Before submitting a Pull Request please run valgrind and the clang static code analyzer.