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

Split MISRA checking into its own job to avoid clutter

parent 4a8cc45f
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,18 @@ cppcheck: ...@@ -46,6 +46,18 @@ cppcheck:
tags: tags:
- helit - helit
cppcheck-misra:
stage: build
before_script:
# install cppcheck from the sid repos in order to get the latest version
- 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
script:
- ci/cppcheck-misra.sh
tags:
- helit
.vera: .vera:
stage: build stage: build
before_script: before_script:
......
#!/usr/bin/env bash
#
# Static code analysis for MISRA C-2012 compliance using cppcheck
#
# Usage:
# $ ci/cppcheck-misra.sh
#
echo -e "\033[0;34mStarting cppcheck...\033[0m"
echo -e "\033[0;34mRunning cppcheck with MISRA C(2012) rule compliance tests...\033[0m"
# grab the MISRA addon and the cppcheck addon interface from github
curl https://raw.githubusercontent.com/danmar/cppcheck/f4b5b156d720c712f6ce99f6e01d8c1b3f800d52/addons/misra.py > misra.py
curl https://raw.githubusercontent.com/danmar/cppcheck/f4b5b156d720c712f6ce99f6e01d8c1b3f800d52/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
...@@ -13,22 +13,4 @@ echo -e "\033[0;34mRunning cppcheck with default checklist...\033[0m" ...@@ -13,22 +13,4 @@ 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
\ No newline at end of file
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/f4b5b156d720c712f6ce99f6e01d8c1b3f800d52/addons/misra.py > misra.py
curl https://raw.githubusercontent.com/danmar/cppcheck/f4b5b156d720c712f6ce99f6e01d8c1b3f800d52/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