Code::Blocks

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Jewest on March 09, 2018, 09:30:02 am

Title: Cppchecker running addon MISRA
Post by: Jewest on March 09, 2018, 09:30:02 am
Hello,

I am currently using the cppcheck plugin and was wondering if it would be possible to run the MISRA checker addon as well.
What I understand from the documentation of cppchecker chapter 12 is that I need to dump the files and then use the python check.
Can I integrate this in Code blocks in an easy way?

Best regards,

Jewest
Title: Re: Cppchecker running addon MISRA
Post by: oBFusCATed on March 09, 2018, 10:15:16 am
It depends what changes in the invocation and the output of cppcheck. If it doesn't require changes to the parsing then it will be easy. But first you need to find how to run it then you could probably easily modify the plugin.
Title: Re: Cppchecker running addon MISRA
Post by: Jewest on March 09, 2018, 12:26:33 pm
running it is easy.
command prompt:
cppchecker --logfile <directory>
python <path misra.py>/misra.py

example on my linux box:
cppcheck --dump ./src/
python /usr/bin/misra.py ./src/*.dump

checking the folder a lot of dump files are create, so I am guessing del *.dump would be in order once the data is processed

example output:
[src/deviceinformation.hpp:6] misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-20.1]

So I am guessing that by adding the rule file you can turn on an off the options.
If this works than C::B will have MISRA checking build in, making it a more powerfull tool.
Title: Re: Cppchecker running addon MISRA
Post by: oBFusCATed on March 09, 2018, 05:54:40 pm
Now you need to modify the cppcheck plugin to support this workflow.
Patches welcome. :)
Title: Re: Cppchecker running addon MISRA
Post by: Jewest on March 12, 2018, 08:33:00 am
I'll see what I can do  ;)
As soon as I can find a spot I'll try and work on it.