Set Baseline Polyspace as You Code Results on Command Line
For more efficient bug fixing, you can create a local baseline or download a previous Polyspace Bug Finder analysis from Polyspace® Access™ to use as a baseline. You can use the baseline by comparing the baseline results against new results or unreviewed results in your current Polyspace as You Code analysis.
Baselines are limited to showing results from the version the analysis took place. For example, a baseline of a result from a R2024a analysis might not contain the same results as a R2024b analysis. Polyspace as You Code displays a warning if you are using a baseline from a different version of Polyspace. You are unable to use the results of a Polyspace Code Prover™ analysis as a baseline in Polyspace as You Code.
Note
To keep using the most up-to-date baseline information, make sure that you periodically run the command to download results from Polyspace Access. See Step 2: Download Baseline.
What Baseline Results Look Like
The effect of setting a baseline depends on whether you export results to the
console or JSON format (SARIF). For more details on the formats, see polyspace-results-export
(Polyspace Bug Finder).
Console Output
Results that have a justified Status on Polyspace Access (No Action Planned, Justified, or Not a Defect) are no longer shown in the console output.
JSON Output
In the following statements,
represents the JSON object that is exported from the Polyspace results.obj
If a result is new and not already present in Polyspace Access, the corresponding property
is set toobj
.runs[0].results[n
].baselineState"new"
:Otherwise, the property is set to"baselineState" : "new"
"unchanged"
.Results carry over their review information (Status, Severity and additional notes) from Polyspace Access to the corresponding properties in
.obj
.runs[0].results[n
].propertiesFor instance, without a baseline, these properties are:
With a baseline, the"severity" : "Unset", "status" : "Unreviewed", "comment" : ""
severity
can be different from"Unset"
, thestatus
different from"Unreviewed"
, and so on.Results that have a justified Status on Polyspace Access (No Action Planned, Justified, or Not a Defect) appear with the property
set toobj
.runs[0].results[n
].properties.justifiedtrue
:"justified" : true
Setting Baseline Steps
To use Polyspace Bug Finder™ Server™ results as baseline for a Polyspace as You Code analysis, follow the steps below.
Step 1: Identify Project to Use as Baseline
First, identify a project in Polyspace Access that you want to use as baseline. The project must contain results of a Polyspace Bug Finder Server analysis on files that you will analyze in Polyspace as You Code.
Copy the path to the project that you want to use as baseline. To copy this path:
Open the Polyspace Access web interface in a web browser.
On the Project Explorer pane, right-click the project and select Copy Project Path to Clipboard.
Step 2: Download Baseline
Next, download the baseline information from the Polyspace Access project. For instance, in a terminal, enter the following:
polyspace-access -host hostname -download projectPath -output-folder-path downloadFolder
is the name of the Polyspace Access server.hostname
is the path to the project on Polyspace Access that is used as baseline. You copied this name from the Polyspace Access web interface.projectPath
is the folder to which you download the baseline information.downloadFolder
After download, the folder contains three databases: results
(ps_results.psbf
), source files
(ps_sources.db
), and review information
(ps_comments.db
). You cannot open these results in the
Polyspace user interface or use them in any other way other than as baseline for
Polyspace as You Code runs.
The folder also contains a file ps_access_info.json
that
contains information about the Access project and run ID that was used as baseline.
If required, you can write a script to compare this run ID with the latest run ID of
the project on Polyspace
Access and run this script at certain points in your workflow to make sure
that you are always using the latest run of the project as baseline.
Step 3: Use Baseline
Once the baseline download completes, import the downloaded baseline information
into your current analysis by using option -import-comments
. In a
terminal, enter the following:
#Linux command polyspace-bug-finder-access -sources filename -import-comments downloadFolder \ -results-dir#DOS command polyspace-bug-finder-access.exe -sources filename -import-comments downloadFolder ^ -results-dir
resultsFolder
resultsFolder
Here:
is the current file being analyzed.filename
is the folder to which you previously downloaded the baseline information.downloadFolder
is the folder for storing analysis results.resultsFolder
You can see the effects of using the baseline when you export the analysis results
by using the polyspace-results-export
command. For
instance:
polyspace-results-export -format console -results-dir resultsFolder
See Also
polyspace-bug-finder-access
| polyspace-results-export
(Polyspace Bug Finder)