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 settings
sets project settings, overrides
und settings -<CategoryNameOfSetting> <value> ... <database.und>
The 'settings' command is use to modify the settings in an Understand project. The names for each setting can be found via 'und list -all settings project.und'
Basic Settings
Setting a value works under a "mush" strategy. e.g.
und settings -CategoryNameOfSetting true
So, to change a setting
1) Type a "-"
2) Type in the setting heading (like report, metrics, C++, and so on) Do not include subheadings (-c++ignore not -c++includesignore).
3) Type in the name (as it appears in und list settings) of the setting to change without any spaces or quotes
4) Type the new value(s) for that setting.
For example:
settings -ReportDisplayCreationDate on
settings -ReportDisplayParameters on
settings -ReportFileNameDisplayMode full
All project settings can be viewed with the command:
und list -all settings project.und
Lists (such as includes, macros, or selected metrics)
By default, a switch changing a list will clear the previous list. If you only wish to add to the list without clearing the previous list append the word "add" onto the end of the switch. Any list command can take in a list file (@fileWithArgs.txt). For example this would enable ONLY these two reports:
settings -ReportReports "Data Dictionary" "File Contents"
And the Add keyword would append the list already enabled:
settings -ReportReportsAdd "Data Dictionary"
settings -C++MacrosAdd MYLONG="Long Text"
Lists of a fixed set of values (languages, reports, selected metrics) also accept the keyword "all", which stands for every value that setting allows. A few settings leave one out on purpose - "all" does not include Assembly for -languages. It works with the Add and Remove forms too, so "all" with Remove clears the list.
settings -metric all
settings -ReportReports all
settings -ReportReportsRemove all
Custom Values
Some options allow for custom values, like the HTML number of pages, which can be single, alphabetic, or every N entities where N is a custom value. In this case, the value for that setting can be shown either as NEntity=Value or simply as Value.
settings -ReportNumberOfPages NEntity=250
settings -ReportNumberOfPages 250
General Commands
General commands do not have to be prepended with "general," so, for example both -generalLanguages and -languages would set the project languages.
Override Commands
Override commands must have the file or directory they are applied to as the first argument following the switch. For example,
und settings -override_c++Includes forThisFile.cpp include1 include2 ...
would be a valid format. There are two options for overriding multiple files:
1) A text file may be used where each line starts with the file to be overridden and is followed by all the override switches for that file. Lines starting with # (not -c#) are ignored. The file could look like this
# Some comment that is ignored file1 -override_c++_includes inc1 inc2 -override_c++_macros ... file2 -override_c++_includes inc3 inc1 -override_file_encoding UTF-8 directory -file_types .h=c++ # Comments here are okay.
The file should start with @ so the command could look like this
und settings -override @overrideFile.txt myProject.und
2) The command can take a list of files followed by == and then the arguments for the override switch. The arguments will be applied to each file. So, for example
-override_c++Includes f1.c f2.c == i1 i2 -override_c++_macros f3.c ...
would be equivalent to
und settings -override_c++Includes f1.c i1 i2
und settings -override_c++Includes f2.c i1 i2
und settings -override_c++_macros f3.c ...
Text Files
A text file can be read in containing all the settings. The '#' sign designates comments unless prepended by -c (because then it refers to the C# language. The '#' sign can be included as a value by prepending a '\'. Whitespace is ignored unless in quotes. Literal quotes can be added by prepending a '\'. The switches and parameters should appear the same as they would on the command line. For example, a file could look like this
-ReportDisplayCreationDate on -ReportReports report1 report2 # Comments and whitespace are ignored report3 -anotherSwitch moreParameters ...
The file should be prepended with @, and could be run like this
und settings @fileWithSettings.txt myProject.und