mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Add pre-commit hook clang-format example
Regards https://github.com/profanity-im/profanity/issues/1396
This commit is contained in:
parent
9b55f2dec0
commit
1bbb819dac
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user