Justification Files

You can provide justifications in one or more companion files, in a simple text format. No access and no change to source code is necessary with this workflow.

These companion files are included in reports with option -include-justifications followed by their file name(s) separated with a comma.

File Format

A justification file is structured on two levels. A new source file is referenced with a line starting with an "@". After that, each line starts with the line number of the counter to be justified.

The key CTC++ Justify must be omitted, everything else follows the structure of justifications in source code. Empty lines and every line not starting with an "@" or a number are ignored.
@C:\users\chandlerbing\dev-projects\alpha\src\transponster.c
122 True  | DEFENSIVE: Must be present because of development guideline, never reached.
198 False | Endless Loop: Part of system design.
621       | DEFENSIVE: Default cannot be reached, enumeration used.
                  
@C:\users\chandlerbing\dev-projects\alpha\src\wenus.c
13 Function | SmallFunction: No test needed due to low complexity.

Collection of Justifications

HTML reports generated with justifications provide a helper function to collect new justifications in correct format. They are collected in the report and then copied via clipboard to a companion file.

Paths in Companion Files

You can always use full paths to source files in @-lines of companion files, if there is no need for mapping paths with -map-source-identification in your project.

Mappings provided with -map-source-identification are also applied to file identfications in companion files. Hence you can also reference source files in @-lines in the following way:
  • If you are already using -map-source-identification with a common, equally named root like alpha in build paths and paths during report generation, you can record the files with a path fragment like alpha\src\write_helpers.c. This helps share justification files with other users.
  • If you do not have an equally named root in decentralized repositories and you want to share justification files, others (or you) have to add one or more mapping with -map-source-identification.