feat: have cppcheck linter respect CACHE_DIR env variable

This commit is contained in:
pasta 2024-08-04 02:43:00 -05:00
parent d1addb27aa
commit ed8ffa7fb4
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -80,10 +80,15 @@ ENABLED_CHECKS_REGEXP=$(join_array "|" "${ENABLED_CHECKS[@]}")
IGNORED_WARNINGS_REGEXP=$(join_array "|" "${IGNORED_WARNINGS[@]}")
FILES_REGEXP=$(join_array "|" "${FILES[@]}")
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CPPCHECK_DIR=$SCRIPT_DIR/.cppcheck/
# Check if CACHE_DIR is set and non-empty, otherwise use default .cppcheck/ directory
if [[ -n "$CACHE_DIR" ]]; then
CPPCHECK_DIR=$CACHE_DIR/cppcheck/
else
CPPCHECK_DIR=$SCRIPT_DIR/.cppcheck/
fi
if [ ! -d $CPPCHECK_DIR ]
then
mkdir $CPPCHECK_DIR
mkdir -p $CPPCHECK_DIR
fi
WARNINGS=$(echo "${FILES}" | \
xargs cppcheck --enable=all --inline-suppr --suppress=missingIncludeSystem --cppcheck-build-dir=$CPPCHECK_DIR -j "$(getconf _NPROCESSORS_ONLN)" --language=c++ --std=c++17 --template=gcc -D__cplusplus -DENABLE_WALLET -DCLIENT_VERSION_BUILD -DCLIENT_VERSION_IS_RELEASE -DCLIENT_VERSION_MAJOR -DCLIENT_VERSION_MINOR -DCOPYRIGHT_YEAR -DDEBUG -DUSE_EPOLL -DCHAR_BIT=8 -I src/ -q 2>&1 | sort -u | \