From 428f0d3bf421830c2315ae84795773db36aecabf Mon Sep 17 00:00:00 2001 From: Grigoris Pavlakis <grigpavl@ece.auth.gr> Date: Wed, 20 Mar 2019 20:16:00 +0200 Subject: [PATCH] Add machine-readable report capability --- ci/cppcheck-misra.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ci/cppcheck-misra.sh b/ci/cppcheck-misra.sh index deca8a6f..5e033050 100755 --- a/ci/cppcheck-misra.sh +++ b/ci/cppcheck-misra.sh @@ -7,8 +7,6 @@ # $ ci/cppcheck-misra.sh # -echo -e "\u001b[34;1mStarting cppcheck...\u001b[0m" - echo -e "\u001b[34;1mRunning cppcheck with MISRA C(2012) rule compliance tests...\u001b[0m" # grab the MISRA addon and the cppcheck addon interface from github @@ -16,13 +14,18 @@ curl https://raw.githubusercontent.com/danmar/cppcheck/f4b5b156d720c712f6ce99f6e 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 +#for file in $(find inc/ src/ -type f) +#do +# cppcheck --dump $file +#done -# run the MISRA checks against the dumps +# run the MISRA checks against the dumps and send the results to a file for file in $(find inc/ src/ -type f -name "*.dump") do - python misra.py $file + python misra.py $file >> ci/report.msr 2>&1 done + +# clean up the report file from any useless info +sed -i -r 's/(.*Script.*)|(.*Checking.*)|(.*MISRA.*)//gm' ci/report.msr +sed -i -r '/(^$)/d' ci/report.msr +sed -i -r 's/(\s\(.*\)\s)//gm' ci/report.msr -- GitLab