Skip to content

Test new compile options #149

Test new compile options

Test new compile options #149

Workflow file for this run

name: cppcheck
on: [push]
jobs:
build:
name: cppcheck-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: cppcheck
uses: deep5050/cppcheck-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN}}
std: c++17
inline_suppression: enable
exclude_check: ./tests
output_file: cppcheck_report.txt
- name: print output
run: |
REPORTFILE=./cppcheck_report.txt
WARNINGSFILE=./warnings.txt
if test -f "$REPORTFILE"; then
# Filter innocuous warnings and write the remaining ones to another file.
# Note that you can add more warnings by adding it in the parenthesis,
# with "\|" in front of it. For example, "(missingIncludeSystem\|useStlAlgorithm\)"
sed 's/\[\(missingIncludeSystem\|unmatchedSuppression\|useStlAlgorithm\)\]//g' "$REPORTFILE" > "$WARNINGSFILE"
# are there any remaining warnings?
if grep -qP '\[[a-zA-Z0-9]+\]' "$WARNINGSFILE"; then
# print the remaining warnings
echo Warnings detected:
echo ==================
cat "$WARNINGSFILE" | grep -P '\[[a-zA-Z0-9]+\]'
# fail the job
exit 1
else
echo No warnings detected
fi
else
echo "$REPORTFILE" not found
fi