The text and XML outputs report unmatchedSuppression errors, but the SARIF output does not. This makes it harder to debug failures when using --enable=all --error-exitcode=1 --output-format=sarif together.
I tested GCC to see how it handles errors without locations and it does not seem to report them. It does signal that the execution failed in an "executionSuccessful" field, though. (You can test this with an unsupported warning for C++: g++ -Werror -Wnested-externs -fdiagnostics-add-output=sarif foo.c)
The text and XML outputs report unmatchedSuppression errors, but the SARIF output does not. This makes it harder to debug failures when using
--enable=all --error-exitcode=1 --output-format=sariftogether.It seems like this behavior might be by design to accommodate GitHub: https://github.com/cppcheck-opensource/cppcheck/blob/9a00e4a1050abdd7452f9afe7d5b323aed0e789a/lib/sarifreport.cpp#L44-L46
The SARIF spec seems to allow for results without locations, but I'm not sure if that plays well with GitHub:
I tested GCC to see how it handles errors without locations and it does not seem to report them. It does signal that the execution failed in an "executionSuccessful" field, though. (You can test this with an unsupported warning for C++:
g++ -Werror -Wnested-externs -fdiagnostics-add-output=sarif foo.c)Steps to reproduce the cppcheck issue:
touch foo.ccppcheck --enable=all --suppress=unusedFunction --output-format=sarif foo.cOutput:
Version info