Today, I’m going to show you how to code in compliance with MISRA C:2012 guidelines using Helix QAC.

The Helix QAC desktop application allows software developers to analyze and fix their code on-demand throughout their day.

Here, I have an open source C project that has been analyzed in accordance with the MISRA C: 2012 coding standard. This enables me to see where rule violations are located in the code so that I can fix them.

One way that I can see which diagnostics are present in this file is by using the “Analysis Results/Diagnostics” window at the bottom of the screen. By default, it is ordered by line and column number starting from the top of the file.

If I double-click the message text on a diagnostic, my cursor is automatically brought to where that diagnostic is located in the file.

Another thing you can do here is use the Severity Filter to filter the diagnostics down to more severe types of issues. For example, I can slide the filter up to level 5 and prioritize the issues that I need to work on. I’d also like to mention that the Severity Levels of diagnostics are completely customizable.

Another way that you can filter your diagnostics is by Rule Group. If I go to the left side of the screen and change from the Files tab to the Rule Groups tab, I can see the Rule Groups associated with my project.

I can then drill down into a particular rule, right-click and “Show Only” to filter the diagnostics below to just the diagnostics that I’ve selected.

Once you’ve found a diagnostic that you want to fix, you can then edit your code right here in Helix QAC, save the file, right-click on the file and re-analyze to see if your code changes fixed the diagnostic.

When it comes to code compliance, reporting on your compliance levels is extremely important. Here is an example of a MISRA C: 2012 compliance report that can be generated using Helix QAC.

I have a high-level compliance summary…

An in-depth compliance table that is showing me the MISRA C: 2012 rule violation counts…per rule...and per file…

I also have a pie chart with another table that is showing me the total violation count per rule…

And I’m also reporting on any suppressions and deviations that I have for MISRA C: 2012 rules.

When it comes to coding standards compliance, control of rule deviations is very important. It is extremely difficult to be 100% compliant to the MISRA C: 2012 standard without any deviations. A tool such as Helix QAC makes it easy to manage rule deviations by suppressing specific rules or diagnostics. This is especially important with legacy code that wasn’t originally written to standard.

That’s just one example of how Helix QAC makes it easy to comply with MISRA. 

If you’re interested in learning more about how Helix QAC will help you, sign up for our next live demo.