Main Content

Set Baseline Polyspace as You Code Results on Command Line

For more efficient bug fixing, you can baseline the results of a Polyspace as You Code analysis with previous results. When you baseline the results, you compare them against the results of a previous run and focus on new results only or on unreviewed results only. You baseline Polyspace as You Code results using previous Polyspace® Bug Finder™ Server™ results that you download from Polyspace Access™.


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.

Results that appear in Polyspace Access act as baseline for a Polyspace as You Code analysis.

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, obj represents the JSON object that is exported from the Polyspace results.

  • If a result is new and not already present in Polyspace Access, the corresponding property obj.runs[0].results[n].baselineState is set to "new":

    "baselineState" : "new"
    Otherwise, the property is set to "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].properties.

    For instance, without a baseline, these properties are:

    "severity" : "Unset",
    "status" : "Unreviewed",
    "comment" : ""
    With a baseline, the severity can be different from "Unset", the status 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 obj.runs[0].results[n].properties.justified set to true:

    "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:

  1. Open the Polyspace Access web interface in a web browser.

  2. On the Project Explorer pane, right-click the project and select Copy Project Path to Clipboard.

Right-click option to copy project path

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

  • hostname is the name of the Polyspace Access server.

  • projectPath is the path to the project on Polyspace Access that is used as baseline. You copied this name from the Polyspace Access web interface.

  • downloadFolder is the folder to which you download the baseline information.

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 resultsFolder

#DOS command

polyspace-bug-finder-access.exe -sources filename -import-comments downloadFolder ^
-results-dir resultsFolder


  • filename is the current file being analyzed.

  • downloadFolder is the folder to which you previously downloaded the baseline information.

  • resultsFolder is the folder for storing analysis results.

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 What Baseline Results Look Like.

See Also

| (Polyspace Bug Finder)

Related Topics