Main Content

polyspace-comments-import

(DOS/UNIX) Import review information from previous Polyspace analysis

Description

Note

This Polyspace® command is available in polyspaceroot\polyspace\bin. Here, polyspaceroot is the Polyspace installation folder, for instance, C:\Program Files\Polyspace\R2024b (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-comments-import -diff-rte prevResultsFolder currentResultsFolder [-print-new-results] [-overwrite-destination-comments] imports review information from a results file in prevResultsFolder to currentResultsFolder. The review information includes the severity, status and additional notes that you assign to a result.

Besides importing the review information, the command also shows the number of results where review information could not be imported either because the result changed or the result already had new review information. If you use the option -print-new-results, you see this information:

  • Number of new results in current results folder, that is, results not present in previous results folder

  • Number of results removed from previous results folder, that is, results no longer present in the current results folder

  • Number of results in current results folder that do not have associated review information

You can also use this command to create a baseline for the analysis results. In the Polyspace user interface, if you click the New button, only the analysis results that are new compared to the baseline remain in the results list.

If you use the option -overwrite-destination-comments, newer review information on previously existing results are overwritten with previous review information. For instance, if the same result has a different status in the current and previous results folder, after using the polyspace-comments-import command:

  • Without the option, the result in the current results folder retains its status.

  • With the option, the status of the result in the current results folder is overwritten with the status from the previous results folder.

example

Examples

collapse all

Run Bug Finder on a sample file and add some review information. Then, run Bug Finder a second time and import the information from the previous run.

Copy the file numerical.c from polyspaceroot\polyspace\examples\cxx\Bug_Finder_Example\sources to a writable folder. Open a command window and navigate to the folder (using cd). Run Bug Finder on the file and save results in the subfolder Run_1:

polyspace-bug-finder -sources numerical.c -results-dir Run_1/
Depending on the product installed, you can also run polyspace-code-prover, polyspace-bug-finder-server or polyspace-code-prover-server.

Open the results file in the Run_1 subfolder:

polyspace Run_1/ps_results.psbf
Select a result. On the Result Details window, select a Severity and Status and add some notes. You will import this review information to results from a later analysis.

Run Bug Finder again, but save the results in a different subfolder Run_2:

polyspace-bug-finder -sources numerical.c -results-dir Run_2/
You can open the results file in Run_2 and see that there is no review information.

Import the review information from the results file in the Run_1 subfolder to the Run_2 subfolder. Add the option -print-new-results to see the number of new, removed and unreviewed results.

polyspace-comments-import -diff-rte Run_1/ Run_2/ -print-new-results

Open the results file in the Run_2 subfolder:

polyspace Run_2/ps_results.psbf
You see the review information imported from the results file in the Run_1 subfolder.

Input Arguments

collapse all

Path to a folder containing a Polyspace results file (.psbf file for Bug Finder results and .pscp file for Code Prover results). The results are presumably from an earlier Polyspace analysis and contain review information that will be imported to a later results file.

Example: "C:\Polyspace\Project_1_Run_25"

Path to a folder containing Polyspace results (.psbf file for Bug Finder results and .pscp file for Code Prover results). The results are presumably from a later Polyspace analysis and have no review information or review information for new results only. You want to import review information from an earlier Polyspace analysis to these results.

Example: "C:\Polyspace\Project_1_Run_26"

Tips

Polyspace Code Prover™ no longer calculates coding rules and coding rule results. If you import Code Prover results from a previous version of Code Prover to the current version, the review information attached to the coding rule and code metrics results are not imported in the Code Prover result.

Version History

Introduced in R2013b