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. 

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.0 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

These commands will run the configuration of checks on all of the files in the project. If you want to run it on just a set of files then specify the files in the Understand GUI and export the .txt file to a location of your choice. 

The command to run with the specified files would then look like this:

und codecheck -files “C:\path\to\CodecheckFileList.txt” “RunChecksDaily” 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