Skip to content

Commit

Permalink
[CI] Add cppcheck script
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed May 26, 2024
1 parent cc2cb2c commit bb7c659
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ jobs:

- name: Install cppcheck
run:
|
sudo apt-get update
sudo apt-get install -y cppcheck
- sudo apt-get update
- sudo apt-get install -y cppcheck

- name: Run cppcheck
run:
cppcheck src --enable=all --force --inline-suppr --quiet --suppress=ConfigurationNotChecked --suppress=unusedFunction
run: ./extras/cppcheck/cppcheck.sh
19 changes: 19 additions & 0 deletions extras/cppcheck/cppcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /bin/bash

file=cppcheck.txt
cppcheck --version
cppcheck src --enable=all --force --inline-suppr --suppress=ConfigurationNotChecked --suppress=unusedFunction --quiet >> $file 2>&1
echo "Cppcheck finished with exit code $?"

error=$(grep ": error:" $file | wc -l)
warning=$(grep ": warning:" $file | wc -l)
style=$(grep ": style:" $file | wc -l)
echo "found $error erros, $warning warnings and $style style issues"
if [ $error -gt "0" ] || [ $warning -gt "0" ] || [ $style -gt "0" ]
then
cat $file
exitcode=1
fi

rm $file
exit $exitcode

0 comments on commit bb7c659

Please sign in to comment.