File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : cppcheck
2
+ on : [push]
3
+
4
+ jobs :
5
+ build :
6
+ name : cppcheck-test
7
+ runs-on : ubuntu-latest
8
+ steps :
9
+ - uses : actions/checkout@v2
10
+
11
+ - name : cppcheck
12
+ uses : deep5050/cppcheck-action@main
13
+ with :
14
+ github_token : ${{ secrets.GITHUB_TOKEN}}
15
+ std : c++17
16
+ inline_suppression : enable
17
+ exclude_check : ./tests
18
+ output_file : cppcheck_report.txt
19
+
20
+ - name : print output
21
+ run : |
22
+ REPORTFILE=./cppcheck_report.txt
23
+ WARNINGSFILE=./warnings.txt
24
+ if test -f "$REPORTFILE"; then
25
+ # Filter innocuous warnings and write the remaining ones to another file.
26
+ # Note that you can add more warnings by adding it in the parenthesis,
27
+ # with "\|" in front of it. For example, "(missingIncludeSystem\|useStlAlgorithm\)"
28
+ sed 's/\[\(missingIncludeSystem\|useStlAlgorithm\)\]//g' "$REPORTFILE" > "$WARNINGSFILE"
29
+ # are there any remaining warnings?
30
+ if grep -qP '\[[a-zA-Z0-9]+\]' "$WARNINGSFILE"; then
31
+ # print the remaining warnings
32
+ echo Warnings detected:
33
+ echo ==================
34
+ cat "$WARNINGSFILE" | grep -P '\[[a-zA-Z0-9]+\]'
35
+ # fail the job
36
+ exit 1
37
+ else
38
+ echo No warnings detected
39
+ fi
40
+ else
41
+ echo "$REPORTFILE" not found
42
+ fi
You can’t perform that action at this time.
0 commit comments