rettichschnidi/clang-tidy-misra

Collaboration with cppcheck

ChisholmKyle opened this issue · 8 comments

I'm excited to see this project underway! I was looking for other open-source initiatives for misra checking and I found the latest development branch of ccpcheck has a misra check addon. There's a sample test file misra-test.c that can be run.

The user who contributed to it is @danmar

Maybe you two can share each other's work?

I am very open for sharing. I could easily put all test-cases into public domain for example.

Cppcheck misra development is blocked currently by legal concerns.

For some background see this thread:
https://www.misra.org.uk/forum/viewtopic.php?f=56&t=1189

I contacted misra to enter into the license agreement they talk about. I don't share the rule texts so I only want to have their permission to use the name. I have talked with them for 2 months now, and I don't expect it will finish now in the summer, so it's a very slow process. It seems to me that having a open source misra tool is a low priority matter for them.

I just want to give a little update. I created a SublimeLinter plugin at https://github.com/ChisholmKyle/SublimeLinter-contrib-cppcheck-misra which uses cppcheck with the misra addon. It works, but requires a bit of a hacky installation. I also added a little tool to parse pdf files but it misses a few rules.

I noticed @danmar also added a parser for a MISRA pdf file. However, I did find issues with incomplete or incorrect output messages when I ran it on the test file and no rule found for Rule 14.1. I think the main problem is only one line is read from the text file but some rule descriptions are multi-line. Also pdftotext output is a little messy and mixed up with other text in some places.

I'm not a cppcheck developer so I didn't go through the trouble to create an issue and just thought I'd mention it here. Hope that's OK

@ChisholmKyle interesting! I plan to release it in a few weeks with cppcheck-1.83. I think the testing of the misra addon is difficult because I don't have access to a code base that is supposed to be misra compatible. Running the addon on arbitrary open source projects cause lots of noise.

I also added a little tool to parse pdf files but it misses a few rules.

Feel free to contribute this to cppcheck. I would like to have such a tool included in the cppcheck installation so users don't need to install extra packages.

I'm not a cppcheck developer so I didn't go through the trouble to create an issue and just thought I'd mention it here. Hope that's OK

I would like to have a ticket in our Trac. I can create a user account for you. Or if you prefer, I can create the ticket for you.

Running the addon on arbitrary open source projects cause lots of noise.

I used your misra-test.c to test the addon. I also couldn't find any FOSS projects that strive for MISRA compliance :(

I would like to have such a tool included in the cppcheck installation so users don't need to install extra packages.

I should clarify that I also parse text output from xPDF's pdftotext to extract the rules. I think the main difference with your python script is I extract multiple lines of text for the rule descriptions instead of just one. I think it's better to extract to a text file once and save it so that you're not always re-running pdftotext on a pdf file. See this script: cppcheck-misra-parsetexts.py

I can create a user account for you

Yes that's fine with me! Thanks.

Also, here's a screenshot of the linter (it's actually quite responsive, updating at least once per second as you type):
cppcheck-misra_screenshot

@danmar The Zephyr RTOS, currently at version 1.11, wants to become MISRA-C 2012 compliant with version 1.13 which is due in summer AFAIK. Maybe you want to have a look at it.

Thanks!

@ChisholmKyle I guess we can close this. Simply re-open if you feel like.