Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ qtest
.devcontainer
core*
.cmd_history
.out

# ctags files
TAGS
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ clean:
(cd traces; rm -f *~)

distclean: clean
rm -f .cmd_history
-rm -f .cmd_history
-rm -rf .out

-include $(deps)
15 changes: 14 additions & 1 deletion scripts/pre-commit.hook
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,32 @@ done
# We suppress the checkLevelNormal warning for Cppcheck versions 2.11 and above.
# Please refer to issues/153 for more details.
CPPCHECK_suppresses="--inline-suppr harness.c \
--suppress=unmatchedSuppression \
--suppress=normalCheckLevelMaxBranches \
--suppress=missingIncludeSystem \
--suppress=noValidConfiguration \
--suppress=unusedFunction \
--suppress=identicalInnerCondition:log2_lshift16.h \
--suppress=nullPointerRedundantCheck:report.c \
--suppress=nullPointerRedundantCheck:harness.c \
--suppress=nullPointerOutOfMemory:harness.c \
--suppress=staticFunction:harness.c \
--suppress=nullPointerRedundantCheck:queue.c \
--suppress=constParameterPointer:queue.c \
--suppress=nullPointer:queue.c \
--suppress=nullPointer:qtest.c \
--suppress=returnDanglingLifetime:report.c \
--suppress=constParameterCallback:console.c \
--suppress=constParameterPointer:console.c \
--suppress=staticFunction:console.c \
--suppress=checkLevelNormal:log2_lshift16.h \
--suppress=preprocessorErrorDirective:random.h \
--suppress=constVariablePointer:linenoise.c \
--suppress=staticFunction:linenoise.c \
--suppress=nullPointerOutOfMemory:web.c \
--suppress=staticFunction:web.c \
"
CPPCHECK_OPTS="-I. --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses $CPPCHECK_unmatched ."
CPPCHECK_OPTS="-I. --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses $CPPCHECK_unmatched --cppcheck-build-dir=.out ."

RETURN=0
CLANG_FORMAT=$(which clang-format)
Expand All @@ -32,6 +43,7 @@ if [ $? -ne 0 ]; then
fi

CPPCHECK=$(which cppcheck)
mkdir -p .out
if [ $? -ne 0 ]; then
echo "[!] cppcheck not installed. Unable to perform static analysis." >&2
exit 1
Expand Down Expand Up @@ -127,6 +139,7 @@ do
done

# static analysis
echo "Running static analysis..."
$CPPCHECK $CPPCHECK_OPTS >/dev/null
if [ $? -ne 0 ]; then
RETURN=1
Expand Down