From 775ad77a79ca7d6e20a5ec879fadd8ff285a648d Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 13 Jun 2020 20:07:28 +0200 Subject: [PATCH] cppcheck.sh: make issues in 'error' category to fail build --- scripts/cppcheck.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/cppcheck.sh b/scripts/cppcheck.sh index 77dcc8ec37c..1f9b81c1379 100755 --- a/scripts/cppcheck.sh +++ b/scripts/cppcheck.sh @@ -28,6 +28,7 @@ cppcheck --library=qt.cfg --inline-suppr \ -DSIP_TRANSFERTHIS= \ -DSIP_INOUT= \ -DSIP_OUT= \ + -DCMAKE_SOURCE_DIR="/foo/bar" \ -j $(nproc) \ ${SCRIPT_DIR}/../src \ >>${LOG_FILE} 2>&1 & @@ -45,7 +46,10 @@ fi ret_code=0 -for category in "error" "style" "performance" "portability"; do +cat ${LOG_FILE} | grep -v -e "syntaxError," -e "cppcheckError," > ${LOG_FILE}.tmp +mv ${LOG_FILE}.tmp ${LOG_FILE} + +for category in "style" "performance" "portability"; do if grep "${category}," ${LOG_FILE} >/dev/null; then echo "INFO: Issues in '${category}' category found, but not considered as making script to fail:" grep "${category}," ${LOG_FILE} | grep -v "clarifyCalculation," @@ -53,7 +57,7 @@ for category in "error" "style" "performance" "portability"; do fi done -for category in "warning" "clarifyCalculation"; do +for category in "error" "warning" "clarifyCalculation"; do if grep "${category}," ${LOG_FILE} >/dev/null; then echo "ERROR: Issues in '${category}' category found:" grep "${category}," ${LOG_FILE}