You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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.

Specifying Report Output Location

You can configure the location of reports with the report.location property. For example:

report.location=[path/to/location]

Alternatively, you can specify the output directory for reports with the -report switch. For example:

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:

report.format=pdf

Generating a .csv Report

  1. Ensure that the project was already analyzed with C/C++test and thatthecpptest.bdffileexists (see above).
  2. Create an empty configuration file (csv.properties) and add the following line:

    cpptest.report.csv.enabled=true
  3. Run code analysis and specify the configuration file with the -settings switch:

    cpptestcli -config "builtin://Recommended Rules" -compiler gcc_9-64 -settings csv.properties -input cpptest.bdf

C/C++test will perform the following tasks:

  1. Run the analysis as described above
  2. Report results to the output console
  3. 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:

  1. Create an XSL file that specifies how you want to transform the XML data.
  2. 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:

ParameterNotes
report_type=disk_report|email_reportDetermines 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.
Example: Recommended Rules

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|falseThe value of the report.suppressed_msgs option. See Report Settings details.
dev_errors=true|falseThe value of the report.developer_errors option. See Report Settings details.
dev_reports=true|falseThe value of the report.developer_reports option. See Report Settings details.
show_active_rules=true|falseThe value of the report.active_rules option. See Report Settings details.
associations=true|falseThe 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|falseThe value of the report.mail.attachments option. See Report Settings details.
authors_details=true|falseThe value of the report.authors_details option. See Report Settings details.
contexts_details=true|falseThe value of the report.contexts_details option. See Report Settings details.

Report File Names

The following table lists the names of the generated report files in each format:

Report FormatReport File Name

HTML

report.html

PDF

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 xUnitreport_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.

  • No labels