Revision 819650069405aa35952033795d76e66994549343 authored by rinkk on 22 March 2021, 14:26:22 UTC, committed by Lars Bilke on 26 March 2021, 09:48:19 UTC
1 parent 1bf1efd
cppcheck.in.sh
# Runs cppcheck with GitLab CI (CodeClimate) output
OUTPUT_FILE=${PROJECT_BINARY_DIR}/cppcheck.json
${CPPCHECK_TOOL_PATH} \
--project=${PROJECT_BINARY_DIR}/compile_commands.json \
--language=c++ \
--std=c++20 \
--enable=all \
--inconclusive \
-j ${CPPCHECK_PARALLEL} \
--suppress=*:*/usr/local\* \
--suppress=*:*cpm\* \
--suppress=*:*Tests\* \
--template='{\n "description": "{message}",\n "severity": "info",\n "location": {\n "path": "{file}",\n "lines": {\n "begin": {line}\n }\n }\n},' \
--output-file=$OUTPUT_FILE \
echo "$( \
# add brackets
printf '[\n'; \
cat $OUTPUT_FILE | \
# strip source code absolute path
sed 's|${PROJECT_SOURCE_DIR}/||' | \
# escape strings
sed 's/string literal "\(.*\)" to/string literal \\"\1\\" to/g' | \
# remove last comma
sed '$s/,$//'; \
printf ']\n')" \
> $OUTPUT_FILE
if [ -f ${Python3_EXECUTABLE} ]; then
${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/test/cppcheck_gen_hashes.py $OUTPUT_FILE
fi
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...