Skip to content

Commit e2372ba

Browse files
Eliminate unintended suppression
To maintain compatibility across different Cppcheck versions, this commit suppresses 'unmatchedSuppression' warnings for each .c and .h file in the project. Without this, pre-commit would fail when existing suppressions no longer match due to changes in Cppcheck behavior. Co-authored-by: JimmyChongz <[email protected]>
1 parent 01f97ef commit e2372ba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/pre-commit.hook

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

3+
CPPCHECK_unmatched=
4+
for f in *.c *.h; do
5+
CPPCHECK_unmatched="$CPPCHECK_unmatched --suppress=unmatchedSuppression:$f"
6+
done
37
# http-parser was taken from Node.js, and we don't tend to validate it.
48
CPPCHECK_suppresses="--suppress=missingIncludeSystem \
59
--suppress=unusedFunction:http_parser.c \
@@ -8,7 +12,7 @@ CPPCHECK_suppresses="--suppress=missingIncludeSystem \
812
--suppress=unknownMacro:http_server.c \
913
--suppress=unusedStructMember:http_parser.h \
1014
--suppress=unusedStructMember:http_server.h"
11-
CPPCHECK_OPTS="-I. --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses"
15+
CPPCHECK_OPTS="-I. --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses $CPPCHECK_unmatched"
1216

1317
RETURN=0
1418
CLANG_FORMAT=$(which clang-format)

0 commit comments

Comments
 (0)