From ca32d7704fe5bcdce1c425424c9b945d92d71dcd Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Thu, 4 Nov 2021 13:29:13 +0100 Subject: [PATCH] cppcheck: output all annotations as error on script error `cppcheck` has a non-zero exit code even on warnings, so to not confuse contributors, align the annotation output with that. --- dist/tools/cppcheck/check.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dist/tools/cppcheck/check.sh b/dist/tools/cppcheck/check.sh index 8ce836c247..cfb694ce77 100755 --- a/dist/tools/cppcheck/check.sh +++ b/dist/tools/cppcheck/check.sh @@ -80,7 +80,10 @@ if github_annotate_is_on; then DETAILS="${DETAILS} * (reason: "; then + # contributors get confused if CI errors (i.e. non-zero result), but outputs only warnings + # => make all warnings errors on non-zero output. Otherwise, use severity level of output + # to determine annotation type. + if [ ${RESULT} -ne 0 ] || echo "${SEVERITY}" | grep -q "\"; then github_annotate_error "${FILE}" "${LINENUM}" "${DETAILS}" else github_annotate_warning "${FILE}" "${LINENUM}" "${DETAILS}"