und is the command-line interface to Understand — script project creation, analysis, CodeCheck, metrics, and reports, locally or in CI.
Run Understand from the command line · Headless workflow: create, analyze, check, report
und analyze
analyzes the project files
The analyze command analyzes project files. By default, it analyzes all files. So, the command:
und analyze myProject.und
would analyze all files in myProject.und. Switches that control what is analyzed are:
| Option | Description |
|---|---|
-all | Analyze all the files in the project, default. |
-changed | Analyze only files that have changed since the last analyze. |
-files | Analyze only these files. Takes a list of files as an argument or a text file containing a list of all the files to add. The text file should have one file name per line, and start with a @. For example:und analyze -files @someFile.txt would analyze all the files contained in someFile.txt. Lines in the file starting with # will be ignored. |
There are also switches to control the output. If any of these switches are used, then only the analysis summary and the values given by the switches are output. So
und analyze -errors myProject.und
will only output analysis errors and the summary line with error and warning totals. The switches are:
| Option | Description |
|---|---|
-accuracy | The accuracy metric as shown on Project Overview Charts. This will appear after the summary. |
-errors | Analysis errors |
-warnings | Analysis warnings |
-progress | Analysis progress as a percentage. |
The analysis errors and warnings can also be written to a file in SARIF (Static Analysis Results Interchange Format) JSON. The -sarif switch requires an output file:
| Option | Description |
|---|---|
-sarif outputFile | Write the analysis errors and warnings to the given file in SARIF JSON format. |
und analyze -sarif parselog.sarif myProject.und
Some examples of the command are:
und analyze myProject.und
und -db myProject.und analyze -changed
analyze -files file1.cpp file2.cpp file3.cpp (Interactive mode)