Skip to content

Commit 5800852

Browse files
committed
Drop FILE_LIST variable
1 parent cd0c09c commit 5800852

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

scripts/pre-commit.hook

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/usr/bin/env bash
22

3-
FILE_LIST=.include_file
4-
53
CPPCHECK_suppresses="--suppress=missingIncludeSystem"
6-
CPPCHECK_OPTS="-I. --file-list=$FILE_LIST --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses"
4+
CPPCHECK_OPTS="-I. --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses"
75

86
RETURN=0
97
CLANG_FORMAT=$(which clang-format)
@@ -75,8 +73,9 @@ do
7573
done
7674

7775
# static analysis
78-
git ls-files *.c > $FILE_LIST
79-
$CPPCHECK $CPPCHECK_OPTS >/dev/null
76+
git ls-tree --full-tree -r --name-only HEAD | \
77+
grep -v compat | grep -E "\.(c|cc|cpp|h|hh|hpp)\$" | \
78+
xargs $CPPCHECK $CPPCHECK_OPTS >/dev/null
8079
if [ $? -ne 0 ]; then
8180
RETURN=1
8281
echo "" >&2

0 commit comments

Comments
 (0)