We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd0c09c commit 5800852Copy full SHA for 5800852
scripts/pre-commit.hook
@@ -1,9 +1,7 @@
1
#!/usr/bin/env bash
2
3
-FILE_LIST=.include_file
4
-
5
CPPCHECK_suppresses="--suppress=missingIncludeSystem"
6
-CPPCHECK_OPTS="-I. --file-list=$FILE_LIST --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses"
+CPPCHECK_OPTS="-I. --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses"
7
8
RETURN=0
9
CLANG_FORMAT=$(which clang-format)
@@ -75,8 +73,9 @@ do
75
73
done
76
74
77
# static analysis
78
-git ls-files *.c > $FILE_LIST
79
-$CPPCHECK $CPPCHECK_OPTS >/dev/null
+git ls-tree --full-tree -r --name-only HEAD | \
+ grep -v compat | grep -E "\.(c|cc|cpp|h|hh|hpp)\$" | \
+ xargs $CPPCHECK $CPPCHECK_OPTS >/dev/null
80
if [ $? -ne 0 ]; then
81
RETURN=1
82
echo "" >&2
0 commit comments