Abstract: Understand’s CodeCheck features let your team catch bugs before they even make it to QA and help keep your code readable and maintainable.
When is a software bug not an issue? When it never leaves the engineer’s system. IBM calculated that it takes 15 times more work to fix a software bug after it is released, so using a tool like Understand to automatically find these issues pays for itself very quickly. At the same time, it can help you implement your team’s coding standards and style guide.
Style AND Substance
Hundreds of papers have been written about the importance of making code readable, and many coding standard rules exist solely to improve the readability of the code. Easy-to-read code contributes to fewer bugs, easier maintenance, and extensibility.
While they may disagree about the specifics, every engineer I have ever met admits that there are some things they absolutely do not want to see in code they have to work with. It doesn’t really matter whether your team decides that opening braces should be on their own lines or not, or that camelCase is superior to Hungarian notation, it’s more important that everyone on your team tries to follow the same style. So, like it or not, most teams have a coding standard in place to make code more readable and reduce bugs. In some cases, entire industries have agreed on a set coding standard (such as AUTOSAR in the automotive industry).
On the other end of the static-analysis spectrum are checks designed to look for logic issues and potential bugs. These checks range from warning about using much-maligned goto statements to identifying potential memory management issues and avoiding dependency hell.
CodeCheck lets you select your own set of checks to run from several industry standards:
- Effective C++ (3rd Edition) Scott Meyers
- AUTOSAR C++ 14
- MISRA-C 2004
- MISRA-C++ 2008
- MISRA-C 2012
- Hersteller Initiative Software (HIS) Metrics
In addition, you can pick from our collection of hundreds of different checks to build the perfect standard for your team. If we don’t have exactly what you’re team needs our Python and Perl APIs make it easy to add your own checks, and we’re happy to help!
Code Check Reports
There are several different options in Understand for analyzing with CodeCheck depending on your use case. Issues can be sorted and filtered as desired, however, I really like the nifty Treemap graph which highlights the real problem areas. Just look for the biggest, darkest square and that’s likely where the problems are.
We prefer to make CodeCheck part of our workflow using our Continuous Integration process. So every time an engineer makes a commit, we have Jenkins run an analysis of their changes with CodeCheck and email them with any violations. I walk through the full process in this article and we’re happy to help your team set it up as well if you run into any issues.
In collaboration with the US Navy’s SBIR program, we have been working on several exciting enhancements to CodeCheck in the SciTools’ skunkworks. We’re not ready to announce all of them but I can say that we are polishing up the ability to display issues automatically while you are working directly in the code. There are also fix-it hints that let you fix many of the issues with a click of the button.
If you haven’t already, sign up for our monthly newsletter to get notified when we add this and other great new features to CodeCheck.