Skip to content
Snippets Groups Projects
Commit dd6bdeae authored by Grigoris Pavlakis's avatar Grigoris Pavlakis Committed by kongr45gpen
Browse files

Add MISRA support to cppcheck - test #1

Attempt to fix the segfaults that showed up

Fix escape codes and a syntax error in the for-loops

Add a line feed to `do` so that Bash stops whining

Update ci/cppcheck.sh

Fix segfaults, attempt #2

Update cppcheck to version 1.86-1

Fix the for loops
parent d5aac3df
No related branches found
No related tags found
No related merge requests found
...@@ -38,9 +38,9 @@ before_script: ...@@ -38,9 +38,9 @@ before_script:
cppcheck: cppcheck:
stage: build stage: build
before_script: before_script:
- apt-get update -qq && apt-get install -y -qq cppcheck - echo deb http://deb.debian.org/debian sid main > /etc/apt/sources.list
- apt-get update -qq && apt-get -t sid install -y -qq cppcheck
- cppcheck --version - cppcheck --version
- cppcheck --doc
script: script:
- ci/cppcheck.sh - ci/cppcheck.sh
tags: tags:
......
...@@ -7,8 +7,28 @@ ...@@ -7,8 +7,28 @@
# $ ci/cppcheck.sh # $ ci/cppcheck.sh
# #
echo -e "\033[0;34mRunning cppcheck...\033[0m" echo -e "\033[0;34mStarting cppcheck...\033[0m"
echo -e "\033[0;34mRunning cppcheck with default checklist...\033[0m"
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
cppcheck --enable=all --inline-suppr --suppress=unusedFunction --suppress=missingIncludeSystem \ cppcheck --enable=all --inline-suppr --suppress=unusedFunction --suppress=missingIncludeSystem \
--suppress=noExplicitConstructor --error-exitcode=1 -I inc src test --suppress=noExplicitConstructor --error-exitcode=1 -I inc src test
echo -e "\033[33mRunning cppcheck with MISRA rule compliance tests...\033[0m"
# grab the MISRA addon and the cppcheck addon interface from github
curl https://raw.githubusercontent.com/danmar/cppcheck/master/addons/misra.py > misra.py
curl https://raw.githubusercontent.com/danmar/cppcheck/master/addons/cppcheckdata.py > cppcheckdata.py
# generate dump files (XML representations of AST etc.) for all headers, source files etc.
for file in $(find inc/ src/ -type f)
do
cppcheck --dump $file
done
# run the MISRA checks against the dumps
for file in $(find inc/ src/ -type f -name "*.dump")
do
python misra.py $file
done
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment