Understand provides a way to check your code using published coding standards, or your own custom standards. These checks can be used to verify naming guidelines, metric requirements, published best practices, or any other rules or conventions that are important for your team.
To get started with Codecheck let’s open it by going to the top-level menu in Understand and selecting Checks → Open Codecheck:
Published Coding Standards
Here you’ll will find many checks straight from the following published standards:
- Effective C++ (3rd Edition) Scott Meyers
- MISRA-C 2004
- MISRA-C++ 2008
- MISRA-C 2012
- Hersteller Initiative Software (HIS) Metrics
as well as a “Sandbox” configuration where you can mix and match checks without them being saved to the project.
Creating a Custom Configuration
To create your own custom configuration, press the wrench icon to the right of the configuration dropdown, press the ‘plus’ button in the top left of the config interface (shown above), choose some checks, and press save - it’s as easy as that.
Now that we know which checks we want to run, let’s run them! At the top of the Codecheck dock just choose a built-in or custom configuration, which project files to run the checks on, and press ‘Inspect’.
Viewing Your Results
Once you’ve run your checks you can view the results in several different formats with the Results dropdown in the top right of the Codecheck tab. Here you can view the violations by file, by check, or even in a treemap or locator view. If your Codecheck has any script errors, you’ll be able to see those by using the ‘Log’ view:
The ‘Log’ view also gives you a great inspection summary where you can see an immediate snapshot of the results:
Want to export the results and send them to a coworker? Just press the ‘export’ button in the top left of the Codecheck tab, select where to save the file, and you’re all done.
Does your team have specific standards that you would like to easily test for but the check isn’t already in the collection of checks included in Code Check? Send us an email at firstname.lastname@example.org with your team’s standards and we will send you a quote. You can also write your own CodeCheck rules using the Perl or Python APIs, just let us know if you get stuck and need a hand.
For a visual walkthrough on setting up your custom configuration, running Codecheck, and analyzing the results, check out our Codecheck overview video right here: