Skip to content

Commit

Permalink
cppcheck.sh: make issues in 'error' category to fail build
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and nyalldawson committed Jun 15, 2020
1 parent 949f631 commit 775ad77
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/cppcheck.sh
Expand Up @@ -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 &
Expand All @@ -45,15 +46,18 @@ 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,"
echo ""
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}
Expand Down

0 comments on commit 775ad77

Please sign in to comment.