Skip to content
Snippets Groups Projects
Unverified Commit 632a2414 authored by kongr45gpen's avatar kongr45gpen
Browse files

Some cleanup and utilities added on cppcheck-misra

parent 5ed4630b
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,13 @@ build ...@@ -3,6 +3,13 @@ build
cmake-build-debug cmake-build-debug
docs docs
# Dump and continuous integration files
*.dump
__pycache__
/ci/cppcheckdata.py
/ci/misra.py
/ci/report.msr
# Prerequisites # Prerequisites
*.d *.d
...@@ -65,3 +72,6 @@ docs ...@@ -65,3 +72,6 @@ docs
.idea/**/uiDesigner.xml .idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml .idea/**/dbnavigator.xml
.idea/**/markdown-* .idea/**/markdown-*
# IDEs
.vscode
\ No newline at end of file
...@@ -7,18 +7,25 @@ ...@@ -7,18 +7,25 @@
# $ ci/cppcheck-misra.sh # $ ci/cppcheck-misra.sh
# #
# make sure we are in the correct directory, regardless of where the script was called from
cd "$(dirname "$0")/.."
echo -e "\u001b[34;1mGetting prerequisites...\u001b[0m" echo -e "\u001b[34;1mGetting prerequisites...\u001b[0m"
# grab the MISRA addon and the cppcheck addon interface from github # grab the MISRA addon and the cppcheck addon interface from github
curl https://raw.githubusercontent.com/danmar/cppcheck/f4b5b156d720c712f6ce99f6e01d8c1b3f800d52/addons/misra.py > ci/misra.py curl https://raw.githubusercontent.com/danmar/cppcheck/f4b5b156d720c712f6ce99f6e01d8c1b3f800d52/addons/misra.py > ci/misra.py
curl https://raw.githubusercontent.com/danmar/cppcheck/f4b5b156d720c712f6ce99f6e01d8c1b3f800d52/addons/cppcheckdata.py > ci/cppcheckdata.py curl https://raw.githubusercontent.com/danmar/cppcheck/f4b5b156d720c712f6ce99f6e01d8c1b3f800d52/addons/cppcheckdata.py > ci/cppcheckdata.py
# clean up old files
echo -e "\u001b[34;1mRemoving old files...\u001b[0m"
echo > ci/report.msr # clear the report file
find inc/ src/ -type f -name "*.dump" | xargs rm
# generate dump files (XML representations of AST etc.) for all headers, source files etc. # generate dump files (XML representations of AST etc.) for all headers, source files etc.
echo -e "\u001b[34;1mGenerating dump files...\u001b[0m" echo -e "\u001b[34;1mGenerating dump files...\u001b[0m"
find inc/ src/ -type f \( -iname "*.cpp" -or -iname "*.hpp" \) | xargs cppcheck --dump find inc/ src/ -type f \( -iname "*.cpp" -or -iname "*.hpp" \) | xargs cppcheck --dump
# run the MISRA checks against the dumps and send the results to a file # run the MISRA checks against the dumps and send the results to a file
echo -e "\u001b[34;1mRunning MISRA C(2012) rule compliance tests...\u001b[0m" echo -e "\u001b[34;1mRunning MISRA C(2012) rule compliance tests...\u001b[0m"
echo > ci/report.msr # clear the report file
find inc/ src/ -type f -name "*.dump" | xargs python3 ci/misra.py >> ci/report.msr 2>&1 find inc/ src/ -type f -name "*.dump" | xargs python3 ci/misra.py >> ci/report.msr 2>&1
# pre-process the generated report to remove all useless strings # pre-process the generated report to remove all useless strings
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment