You can customize reports by configuring the settings in the .properties file (see Configuration Overview). This section describes examples of how your reports can be configured. See Report Settings for a complete list of settings that allow you to customize your reports to your needs.
Table of Contents | ||
---|---|---|
|
Specifying Report Output Location
You can configure the location of reports with the report.location
property. For example:
Code Block |
---|
report.location=[path/to/location] |
Alternatively, you can specify the output directory for reports with the -repor
t switch. For example:
Code Block |
---|
cpptestcli -report /home/reports/html |
Specifying Report Format
By default, an HTML report is generated. You can generate a PDF report or a report with a custom extension to the specified directory by setting the report.format
property. For example:
Code Block |
---|
report.format=pdf |
Generating a .csv Report
- Ensure that the project was already analyzed with C/C++test and thatthecpptest.bdffileexists (see above).
Create an empty configuration file (csv.properties) and add the following line:
Code Block cpptest.report.csv.enabled=true
Run code analysis and specify the configuration file with the
-settings
switch:Code Block cpptestcli -config "builtin://Recommended Rules" -compiler gcc_9-64 -settings csv.properties -input cpptest.bdf
C/C++test will perform the following tasks:
- Run the analysis as described above
- Report results to the output console
- Create an additional report.csvresult file
Support for Custom Report Formats
You can customize locally-generated and emailed reports by building a custom XSL transformer that specifies how you want the results formatted. For instance, you could use a custom transformer to map data into the format you need to demonstrate compliance to an internal security policy.
To specify a custom report format, you need to:
- Create an XSL file that specifies how you want to transform the XML data.
- Specify the location of the XSL file, as well as the extension that should be assigned to the resulting file by configuring the following settings in your .property file:
report.format=custom
report.custom.xsl.file=<path to the XSL file>
report.custom.extension=<extension of the resulting file>
If you perform analysis from your IDE, you can specify the the location of the XSL file and the extension of the resulting file on the Reports preference page; see Generating Reports.
Available Parameters
The following parameters can be used in custom XSL files:
Parameter | Notes |
---|---|
report_type=disk_report|email_report | Determines if the generated report will be sent by email or saved on the local disk drive. |
test_params | The command line that was used to start the product that generated this report. Example: cpptestcli: -config dtp://xtest-static.properties -localsettings /home/nightly/localsettings.properties -publish -report /home/nightly/reports/report.html -resource myproject -dtp.autoconfig [email protected]:8443 |
test_config_name | The name of the test configuration that was executed to produce this report. |
output_dir=[dir] | The directory where the report is created. This can be used to generate developer reports. Example: <xsl:value-of select="concat($output_dir,$dev_reports_prefix,$authid,'.csv')"/> |
rules_dir_path=[path] | The directory where rules documentation is saved. This can be used to generate rule popups/links. Example: <xsl:value-of select="concat('javascript:openWin(',$qt,$rules_dir_path,$id,'.html',$qt,')')"/> |
suppr_msgs=true|false | The value of the report.suppressed_msgs option. See Report Settings details. |
dev_errors=true|false | The value of the report.developer_errors option. See Report Settings details. |
dev_reports=true|false | The value of the report.developer_report s option. See Report Settings details. |
show_active_rules=true|false | The value of the report.active_rules option. See Report Settings details. |
associations=true|false | The value of the report.associations option. See Report Settings details. |
dev_reports_prefix=[prefix] | The prefix used to name developer reports. Example: <xsl:value-of select="concat($output_dir,$dev_reports_prefix,$authid,'.csv')"/> |
attachments=true|false | The value of the report.mail.attachments option. See Report Settings details. |
authors_details=true|false | The value of the report.authors_details option. See Report Settings details. |
contexts_details=true|false | The value of the report.contexts_details option. See Report Settings details. |
Anchor | ||||
---|---|---|---|---|
|
The following table lists the names of the generated report files in each format:
Report Format | Report File Name |
---|---|
HTML | report.html |
report.pdf | |
CSV | report.csv |
XSL custom | report_custom.xml report_custom.html |
JSON SARIF (Static Analysis Results Interchange Format) | report.sarif |
JSON SARIF for Azure DevOps | report_azure.sarif |
JSON SAST for GitLab | report.sast |
XML SATE (Static Analysis Tool Exposition) | report_sate.xml |
XML xUnit | report_xunit.xml |
JSON SAST v14 for GitLab | report_v14.sast |
cppUnit | report_cppunit.xml |
You can customize the report file name, using the report.file.name setting.