Main Content

polyspace-report-generator

R2026b

(System Command) Generate reports from Polyspace analysis results stored locally or on Polyspace Access

Description

The polyspace-report-generator system command generates PDF, Word, or HTML reports from Polyspace® static analysis results by using predefined or custom templates.

Generate Reports from Local Results

Note

This Polyspace command is available in polyspaceroot\polyspace\bin. Here, polyspaceroot is the Polyspace installation folder, for instance, C:\Program Files\Polyspace\R2026b (see also Installation Folder for desktop products or Installation Folder for server products). To avoid typing the full path to this command, add this location to the PATH environment variable in your operating system.

polyspace-report-generator -template outputTemplate [reporting options] generates a report by using the template outputTemplate for the local analysis results that you specify with reporting options.

By default, reports for results from project-name are stored as project-name_report-name in the PathToFolder\Polyspace-Doc folder. PathToFolder is the results folder of project-name.

example

Generate Reports from Polyspace Access Results

polyspace-report-generator -template outputTemplate -host hostName -run-id runID [polyspace access options] [reporting options] [-set-language-english] generates a report by using the template outputTemplate for the analysis results corresponding to run runID on Polyspace Access™. hostName is the fully qualified host name of the machine that hosts Polyspace Access.

By default, reports for results from project-name are stored as project-name_report-name in the PathToFolder\Polyspace-Doc folder. PathToFolder is the path from which you call the command.

For exporting results to a tab-delimited text file, the polyspace-results-export command is preferred.

Examples

collapse all

This example shows how to generate PDF reports on the command line from a Bug Finder results file (.psbf file) stored locally on your machine.

Create a variable template_path to store the path to the report templates and create a variable report_templates to store a comma-separated list of templates to use. The commands below use the SET command available on the Windows® command prompt. Replace the SET command appropriately for other terminals.

SET template_path="C:\Program Files"\Polyspace\R2026b\toolbox\polyspace\psrptgen\templates\bug_finder
SET report_templates=%template_path%\BugFinder.rpt,%template_path%\CodingStandards.rpt
This example uses the following report templates:

  • BugFinder: A report generated using this template shows all Bug Finder results (both defects and coding standard violations).

  • CodingStandards: A report generated using this template contains a file-by-file breakdown of coding standard violations.

For more information on report templates, see Bug Finder and Code Prover report (-report-template).

Using the templates that you specified in the variable report_templates, generate a PDF report from analysis results stored in the folder C:\Polyspace_Workspace\myProject\Module_1\BF_Result.

polyspace-report-generator -template %report_templates% -results-dir C:\Polyspace_Workspace\myProject\Module_1\BF_Result -format PDF

This example shows how to generate PDF reports on the command line from a Code Prover results file (.pscp file) stored locally on your machine.

Create a variable template_path to store the path to the report templates and create a variable report_templates to store a template to use. The commands below use the SET command available on the Windows command prompt. Replace the SET command appropriately for other terminals.

SET template_path="C:\Program Files"\Polyspace\R2026b\toolbox\polyspace\psrptgen\templates\
SET report_templates=%template_path%\Developer.rpt
This example uses the Developer template, which has dedicated chapters on reporting of run-time errors. For more information on the templates, see Bug Finder and Code Prover report (-report-template) (Polyspace Code Prover).

Using the templates that you specified in the variable report_templates, generate a PDF report from analysis results stored in the folder C:\Polyspace_Workspace\myProject\Module_1\CP_Result.

polyspace-report-generator -template %report_templates% -results-dir C:\Polyspace_Workspace\myProject\Module_1\CP_Result -format PDF

Input Arguments

collapse all

Path to the report template that you use to generate an analysis report. To generate multiple reports, specify a comma-separated list of report template paths (do not put a space after the commas). The templates are available in polyspaceroot\toolbox\polyspace\psrptgen\templates\ as .rpt files. Here, polyspaceroot is the Polyspace installation folder. The polyspace-report-generator command accepts the same templates as the analysis option -report-template. For information on the available templates, see Bug Finder and Code Prover report (-report-template).

Example: C:\Program Files\Polyspace\R2019a\toolbox\polyspace\psrptgen\templates\Developer.rpt

Example: TEMPLATE_PATH\BugFinder.rpt,TEMPLATE_PATH\CodingStandards.rpt

Fully qualified host name of the machine that hosts the Polyspace Access Gateway API service. You must specify a host name to generate a report for results on the Polyspace Access database.

Example: my-company-server

Run ID of the project findings for which you generate a report. Polyspace assigns a unique run ID to each analysis run that you upload to the Polyspace Access.

You can see the run ID of a project in the Polyspace Access web interface. To get the run ID, use the command polyspace-access -list-project (Polyspace Access).

OptionDescription
-format HTML | PDF | WORD

File format of the report that you generate. By default, the command generates a Microsoft® Word document.

To generate reports in multiple formats, specify a comma-separated list of formats. (Do not put a space after the commas). For instance, -format PDF,HTML.

-output-name outputName

Name of the generated report or folder name if you generate multiple reports.

The report or exported file is saved on the path from which you call the command. To save in a different folder, specify the full path to the folder, for instance -output-name C:\PathTo\OtherFolder.

-results-dir FOLDER_1,...,FOLDER_N

Path to the locally stored results folder. To generate reports for multiple analyses, specify a comma-separated list of folder path. (Do not put a space after the commas). For example:

-results-dir folderPath1,folderPath2
This option is not compatible with Polyspace Access results.

-set-language-englishGenerate the report in English. Use this option if your display language is set to another language.
-helpDisplay the help information.
OptionDescription

-host HOST_NAME

HOST_NAME corresponds to the host name that you specify in the URL of the Polyspace Access interface, for example https://HOST_NAME:port/metrics/index.html. If you are unsure about which host name to use, contact your Polyspace Access administrator. The default host name is localhost.

This option is mandatory when you generate reports for results stored on the Polyspace Access database.

-run-id RUN_ID

Run ID of the project. Polyspace assigns a unique run ID to each analysis run that you upload. To get the last run ID of a project, use the polyspace-access -list-project (Polyspace Access) command.

This option is mandatory when you generate reports for results stored on the Polyspace Access database.

-all-units

Specify this option to generate a report for all units from a unit by unit analysis.

When you use this option, specify the run ID of only one unit with -run-id. The command includes the other units from the analysis in the report.

-port portNumber

portNumber corresponds to the port number that you specify in the URL of the Polyspace Access interface, for example https://hostname:portNumber/metrics/index.html. If you are unsure about which port number to use, contact your Polyspace Access administrator. The default port number is 9443.

-protocol http | https

HTTP protocol used to connect to Polyspace Access. Default value is https.
-credentials-file file_path

Full path to the text file where you store your login credentials. Use this option if, for instance, you use a command that requires your Polyspace Access credentials in a script but you do not want to store your credentials in that script. While the script runs, someone inspecting currently running processes cannot see your credentials.

You can store only one set of credentials in the file, either as -login and -encrypted-password entries on separate lines, for instance:

-login jsmith
-encrypted-password LAMMMEACDMKEFELKMNDCONEAPECEEKPL
or as an -api-key entry:
-api-key keyValue123
Make sure that you restrict the read and write permissions on the file where you store your credentials. For example, to restrict read and write permissions on file login.txt in Linux®, use this command:
chmod go-rwx login.txt

-api-key keyValue

API key you use as a login credential instead of providing your login and encrypted password. To assign an API key to a user, see Configure User Manager (Polyspace Access) or contact your Polyspace Access administrator.

Use the API key if, for instance, you use a command that requires your Polyspace Access login credentials as part of an automation script with a CI tool like Jenkins®. If a user updates his or her password, you do not need to update the API key associated with that user in your scripts.

It is recommended that you store the API key in a text file and pass that file to the command by using -credentials-file. See the description for option -credentials-file.

-login username

-encrypted-password ENCRYPTED_PASSWD

Credentials that you use to log into Polyspace Access. The argument of -encrypted-password is the output of the polyspace-access -encrypt-password (Polyspace Access) command.

Tips

  • You cannot use the polyspace-report-generator command with results generated with Polyspace as You Code™. Use the polyspace-results-export command instead. See polyspace-results-export.

  • Report generation can take a long time for result sets containing a very large number of defects or coding rules violations. In some cases, you might run into issues from insufficient memory. If that happens, you can either increase the Java® heap size or export the results to a tab-delimited text (TSV) file. The results export is faster than report generation and can complete in reasonable time even for large result sets. For more information, see Fix Insufficient Memory Errors During Polyspace Report Generation.

Alternative Functionality

Instead of generating reports from existing analysis results, you might want a report to be generated along with the analysis. In this case, use the analysis options -report-template and -report-output-format. See Configure Report Generation.

Reports generated along with analysis will only contain review information imported from previous analyses (if any such information is imported). If you add new review information to the results, you will have to regenerate the reports using the polyspace-report-generator command.

Version History

Introduced in R2013b

expand all