Headless workflow — create, analyze, check, report¶
A complete, GUI-free pipeline. Each step is a und command against one .und database.
DB=myProject.und
# 1. Create the database (accepts the same settings as `und settings`)
und -db $DB create -languages c++
# 2. Add source — a directory, or a CMake compilation database for accuracy
und -db $DB add /path/to/src
# or: und -db $DB add -cmake /path/to/build/compile_commands.json
# 3. Configure (any project setting; see settings-and-filters)
und -db $DB settings -C++AddFoundFilesToProject on
# 4. Analyze
und -db $DB analyze # -all is default; use -changed for incremental
# 5. Check coding standards (see the CodeCheck CLI page)
und -db $DB codecheck -exitstatus -sarif out/results.sarif "MyConfig" out
# 6. Metrics and reports
und -db $DB metrics output.csv
und -db $DB report -format html "Line Metrics" out/report
Notes¶
-localoncreatestores machine-specific project data, such as the analysis data, in the project'slocalfolder instead of your user AppData folder. You can also use it to share an analyzed project with someone who can't build it on their machine. They can browse it without analyzing, but to view source they need the files at the same place relative to the project, and analyzing without the source drops the missing files from the data. Don't commit thelocalfolder to version control.analyze -changedonly reparses changed files — fast for CI on each commit (und analyze).settingscan change any project setting — see Configure settings & filters and the und settings reference.codecheckoptions (SARIF, gating, scoping) are on the und codecheck reference page.reporttakes a report name + output and-format pdf,html,txt,csv,png; scope it with-codecheck,-ent, or-arch(und report).metricsoptions (metrics to export, entity unique names, etc.) are on the und metrics reference page.- C/C++ with no
compile_commands.json? Capture the build first with Buildspy in CI.
To wire this into Jenkins with build gating, see Run CodeCheck in CI, and for the full pipeline picture, Run Understand in a CI pipeline.