-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-cppcheck
More file actions
executable file
·46 lines (35 loc) · 1.03 KB
/
run-cppcheck
File metadata and controls
executable file
·46 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Default arguments
ARGS="--enable=all --std=posix --force"
# Additionally define these arguments if run in Jenkins configuration (Jenkins
# cppcheck plugin only understands XML-formatted cppcheck output)
JENKINS_ARGS="--xml --xml-version=2 --inline-suppr "
JENKINS_ARGS+=`cat .cppcheck-ignore | sed "s/.*/-i &/" | tr "\n" " "`
CPPCHECK_XML=cppcheck.xml
JENKINS_MODE=false
while [ -n "$1" ]
do
case "$1" in
-J)
JENKINS_MODE=true
;;
*)
# If we see something not explicitly recognized by this script stop
# processing arguments and pass remaining arguments directly to
# cppcheck
break
;;
esac
# We're done with the current argument, move to the next.
shift
done
if [ "$JENKINS_MODE" == true ]; then
ARGS+=" $JENKINS_ARGS"
fi
ARGS+=" $@"
if [ "$JENKINS_MODE" == true ]; then
cppcheck $ARGS 2> $CPPCHECK_XML
! grep -E '(severity="error"|severity="warning")' $CPPCHECK_XML > /dev/null
else
cppcheck $ARGS
fi