PlatformIO Community

Use Barr-C code standard rules in PIO Checker

Hi, I’m just reading the basic setup of the PIO Checker, I was looking to integrate the Barr-C 2018 standard rules into the check.
I want to know if anybody tried this before with the PIO Checker configurations, before diving into the documentation of each one of the analysis tools to know if they allow doing this (I haven’t used one before, so not sure, only understood that at list the lint descendants could)
CppCheck has MISRA, I was hoping that maybe, something like that could be done but with Barr-C 2018

Thank you a lot for your time, and for pointing me in the right direction.

Have you found a tool this does this?

Unfortunately, I haven’t been able to test this correctly, so not sure if it’s possible with what’s available or if requires something else.

Finally, I put myself to it, and it seems not as difficult as I thought, but it is very time consuming, plus I still have to do some tests to see if I understood correctly how to organize the rules.
First of all, CppCheck currently does not support the entire Misra C 2012, they need help with that.
Now, if I want to add Barr-C I’d need to either add some regexes or subclass the checks and recompile cppcheck. At first glance seems that I will not be able to implement all of it since there are some rules that are pretty complex and are not even suggested for automation, but for peer review check.
I’ll try to play with those rules a bit and come with something useful and let you know.
I’ll come back next year with an update :rofl: