Commit 59660e77 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Get cppcheck changes from master

parent 2148d793
#!/bin/bash -ex
SCRIPT_DIR=$(dirname "$0")
# If errors slip through to master this can be used to set a non-zero
# allowed count while those errors are dealt with. This avoids breaking all
# builds for all developers
ALLOWED_ERRORS_COUNT=288
if [[ ${JOB_NAME} == *pull_requests* ]]; then
# This relies on the fact pull requests use pull/$PR-NAME
......@@ -32,3 +36,17 @@ cmake ${CMAKE_GENERATOR} -DCMAKE_BUILD_TYPE=Debug -DCPPCHECK_GENERATE_XML=TRUE -
# run cppcheck
cmake --build . --target cppcheck
# Generate HTML report
cppcheck-htmlreport --file=cppcheck.xml --title=Embedded --report-dir=cppcheck-report
# Mark build as passed or failed
errors_count=$(grep -c '</error>' $1)
if [ $errors_count -gt ${ALLOWED_ERRORS_COUNT} ]; then
echo "CppCheck found ${ALLOWED_ERRORS_COUNT} errors."
echo "See CppCheck link on the job page for more detail."
exit 1
else
echo "CppCheck found no errors"
exit 0
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment