.gitlab-ci: Generate cppcheck reports

Modify the cppcheck job to also generate cppcheck's reports
and provide them as artifacts to the user.
This commit is contained in:
Moshe Kaplan 2020-08-24 18:47:20 +00:00 committed by Wireshark GitLab Utility
parent 6d752876ef
commit 3dde70de2c
2 changed files with 14 additions and 7 deletions

View File

@ -225,17 +225,22 @@ merge-req:ubuntu-clang-other-tests:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- apt-get install -y cppcheck clang-tools
- apt-get install -y cppcheck clang-tools python-pygments
# build-ubuntu puts us in `build`.
- cd ..
- python3 tools/checklicenses.py
- ./tools/cppcheck/cppcheck.sh -l 1
- ./tools/cppcheck/cppcheck.sh -l 1 -x | tee cppcheck_report.xml
- if [[ -s "cppcheck_report.xml" ]]; then cppcheck-htmlreport --file cppcheck_report.xml --report-dir . ; fi
- cd build
- cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DENABLE_CHECKHF_CONFLICT=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DENABLE_CCACHE=ON -G Ninja ..
- ninja
- ./run/tshark -v
- sh -c '[ ! -e ../tools/validate-clang-check.sh ] || ../tools/validate-clang-check.sh'
- ninja checkAPI
artifacts:
paths:
- cppcheck_report.xml
- cppcheck_report.html
# XXX This is still beta:
# https://docs.gitlab.com/ee/user/gitlab_com/index.html#windows-shared-runners-beta

View File

@ -97,7 +97,7 @@ fi
if [ "$LAST_COMMITS" -gt 0 ] ; then
TARGET=$( git diff --name-only HEAD~"$LAST_COMMITS".. | grep -E '\.(c|cpp)$' )
if [ -z "${TARGET//[[:space:]]/}" ] ; then
echo "No C or C++ files found in the last $LAST_COMMITS commit(s)."
>&2 echo "No C or C++ files found in the last $LAST_COMMITS commit(s)."
exit_cleanup 0
fi
fi
@ -106,7 +106,7 @@ if [ "$OPEN_FILES" = "yes" ] ; then
TARGET=$(git diff --name-only | grep -E '\.(c|cpp)$' )
TARGET="$TARGET $(git diff --staged --name-only | grep -E '\.(c|cpp)$' )"
if [ -z "${TARGET//[[:space:]]/}" ] ; then
echo "No C or C++ files are currently opened (modified or added for next commit)."
>&2 echo "No C or C++ files are currently opened (modified or added for next commit)."
exit_cleanup 0
fi
fi
@ -128,9 +128,11 @@ fi
# runs and we aren't left with broken HTML.
trap : INT
echo "Examining:"
echo $TARGET
echo
if [ "$QUIET" = " " ]; then
echo "Examining:"
echo $TARGET
echo
fi
# shellcheck disable=SC2086
$CPPCHECK --force --enable=style $QUIET \