From fa62d68b95b6295c204f3b9c91f5cef7a73c436c Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 9 Jun 2018 14:46:05 +0200 Subject: cppcheck.sh: enable to run it from any directory --- scripts/cppcheck.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'scripts/cppcheck.sh') diff --git a/scripts/cppcheck.sh b/scripts/cppcheck.sh index df939c06..f1e19f81 100755 --- a/scripts/cppcheck.sh +++ b/scripts/cppcheck.sh @@ -4,13 +4,27 @@ LOG_FILE=/tmp/cppcheck_proj.txt +SCRIPT_DIR=$(dirname "$0") +case $SCRIPT_DIR in + "/"*) + ;; + ".") + SCRIPT_DIR=$(pwd) + ;; + *) + SCRIPT_DIR=$(pwd)/$(dirname "$0") + ;; +esac + +TOPDIR="$SCRIPT_DIR/.." + echo "" > ${LOG_FILE} -for dirname in src; do +for dirname in ${TOPDIR}/src; do echo "Running cppcheck on $dirname... (can be long)" if ! cppcheck --inline-suppr --template='{file}:{line},{severity},{id},{message}' \ --enable=all --inconclusive --std=posix \ -DCPPCHECK \ - $dirname \ + "$dirname" \ -j 8 >>${LOG_FILE} 2>&1 ; then echo "cppcheck failed" exit 1 -- cgit v1.2.3