CodeCheck can be set up to run from the command line using Und if that is your preferred work environment, or if you are looking to automate the task. For more details on how to use Und see this page.
To run CodeCheck from the command line, you will first need to use the Understand GUI to select the specific checks that you wish to run, and save the configuration. To Open CodeCheck, select Checks->Open CodeCheck
To create the new configuration, follow these steps:
1. Click the wrench ( Red Arrow )
2. Click the plus sign ( Blue Arrow )
3. Make sure 'Share this configuration' is checked ( Green Arrow )
4. Name your configuration ( Blue highlight bar )
5. Select the desired checks and click save ( Blue disk icon )
When the configuration is saved with a name of your choice then you can run the check from the command line and you can also share it with other people that want to run the same set of checks. The configuration is saved to the <ProjectName>.und\codecheck\configs directory that exists for each Understand 6 project. The “RunChecksDaily.json” file will be shared through your Version Control when sharing the .und project, or you can simply share the specific .json file.
To run the saved configuration “RunChecksDaily”, the command will look like this:
und codecheck “RunChecksDaily” C:\path\to\OutputDir C:\path\to\ProjectName.und
Where “RunChecksDaily” is my saved configuration, the results are saved to the OutputDir, and it is running the checks on ProjectName.und.
If you are using a saved configuration that is not in the ProjectName.und directory, then you can also specify the path to the .json file. For example:
und codecheck “C:\path\to\RunChecksDaily.json” C:\path\to\OutputDir C:\path\to\ProjectName.und
If you are calling CodeCheck as part of your build process and want it to throw an error if violations are found, there is a switch, -exitStatus, that will return the number of violations as the exit status or 0 if no violations were found.
There are more options for CodeCheck and running it from the command line. All of the options can be found by running:
und help codecheck