Skip to content

Run CodeCheck from the command line

Automate CodeCheck with und codecheck. First create and save a named configuration in the GUI (Checks → Open CodeCheck → wrench → + → pick checks → name it → save). Configurations are stored in <Project>.und/codecheck/configs/ and are shareable (e.g. via version control).

Basic run

und codecheck "<configuration>" <outputDir> <project.und>

You can pass a saved configuration name, or a path to a .json config file. Results are written to <outputDir> (default report CodeCheckResultsByTable.csv; SARIF results.sarif).

Useful switches

Switch Effect
-sarif <file> Write SARIF results to <file> (instead of the default results.sarif).
-reports [name …] / -reports all Choose report(s) to emit; all emits every report.
-gitfiles [id [after]] Only uncommitted changed files (optionally scoped to a git revision).
-changedfiles Only files changed since the last inspection.
-arch "<architecture>" Only files in that architecture (e.g. -arch "Directory Structure/src").
-files @list.txt Run on a specific file list (optionally line ranges like 5,10,12-30).
-previous <old.sarif> Compare against a previous inspection → New_/Fixed_ report variants.
-exitstatus [withexcluded\|errors] Return the violation count as the process exit code.

File-filter switches combine with AND. Full reference: und codecheck (or und help codecheck).

Gate a build

und codecheck -sarif out/results.sarif -exitstatus "RunChecksDaily" ./out project.und
# non-zero exit == violations found -> fail the CI step

Don't gate on the raw count alone

Switches must come before the positional <configuration> <outputDir> [database] arguments. And because operating systems truncate exit codes to one byte, a run with exactly 256 (or 512, …) violations exits 0 — for a robust gate, parse the SARIF/CSV output for the real count instead of trusting the exit code as a total.

See Run CodeCheck in CI for a full pipeline.