...
Alternatively, you can specify the output directory for reports with the -report switch. For example:
| Code Block |
|---|
cpptestcli -report /home/reports/html |
Specifying the Report Format
By default, an HTML report is generated. You can reports are generated in HTML format. To generate a PDF report or a report with a custom extension to the specified directory by setting in a different format, set the report.format property. For example:
| Code Block |
|---|
report.format=pdf |
- See report.format for a list of supported format values. For a detailed description of each format, see Report Formats.
- Additional configuration is required to generate a .csv report or a report with a custom extension. See Generating a .csv Report and Support for Custom Report Formats.
| Anchor | ||||
|---|---|---|---|---|
|
- Ensure that the project was already analyzed with C/C++test and that the cpptest.bdf file exists (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
-settingsswitch:Code Block cpptestcli -config "builtin://Recommended Rules" -compiler gcc_9-64 -settings csv.properties -input cpptest.bdf
...
- Run the analysis as described above
- Report results to the output console
- Create an additional report.csvresultcsv result file
| Anchor | ||||
|---|---|---|---|---|
|
You can customize locally-generated and emailed reports by building a custom XSL transformation that specifies how you want the results formatted. For instance, you could use a custom transformation to map data into the format you need to demonstrate compliance to an internal security policy.
...
- 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 .properties file:
report.format=customreport.custom.xsl.file=<full 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:
...
| Report Format | Description | File Name |
|---|---|---|
HTML | (Default) A report in the HTML format containing all results supported by C/C++test. | report.html |
A report in the PDF format containing all results supported by C/C++test. The report is generated based on an HTML report. | report.pdf | |
CSV | A report in the CSV format containing static analysis results. | report.csv |
XSL custom | A report in a custom format containing results processed by a custom user XSL transformation. All results supported by C/C++test can be included; see Support for Custom Report Formats for details. | report_custom.xml report_custom.html |
JSON SARIF (Static Analysis Results Interchange Format) | A report containing static analysis results according to the SARIF specification; see https://sarifweb.azurewebsites.net/ for details. | report.sarif |
JSON SARIF for Azure DevOps | An Azure DevOps-specific report containing static analysis results according to the SARIF specification; see https://sarifweb.azurewebsites.net/ for details. | report_azure.sarif |
JSON SAST for GitLab | A GitLab-specific report containing static analysis results according to the SAST specification; see https://docs.gitlab.com/user/application_security/sast/ for details. | report.sast |
JSON SAST v14 for GitLab | A GitLab-specific report containing static analysis results according to the SAST v14 specification; see https://docs.gitlab.com/user/application_security/sast/ for details. | report_v14.sast |
XML SATE (Static Analysis Tool Exposition) | A report containing static analysis results according to the SATE specification; see https://samate.nist.gov/SATE4.html for details. | report_sate.xml |
cppUnit | A report in the CppUnit format containing unit test results. | report_cppunit.xml |
| XML xUnit | A report in the xUnit format containing unit test results. | report_xunit.xml |
You can customize the report file name, using the report.file.name setting.