Main Content

Set Baseline Polyspace as You Code Results in Visual Studio Code

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 compare your Polyspace as You Code single-file analysis results against your local baseline or Polyspace Access baseline and focus your review on new results or unreviewed results only.

Baselines contain only results from the Polyspace version used to perform the analysis. For example, a baseline from an earlier version of Polyspace might not contain the same results as an analysis from a later version. Polyspace as You Code displays a warning if you are using a baseline from a different version of Polyspace. You cannot 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 Download Baseline.

Configure Local Baseline

To create a local baseline, right-click a file in the Explorer view or right-click in the editor and select Create a local baseline. You can also create a local baseline by clicking save button in the Quality Monitoring view.

When you create a local baseline for a file, Polyspace analyzes the file and uses the analysis results as a baseline. The results of each subsequent analysis of the file are compared against the baseline.

For more information on interacting with baselines in Visual Studio Code, see Open Additional Polyspace Views.

Configure Polyspace Access Baseline

To use Polyspace Bug Finder™ Server™ results as baseline for a Polyspace as You Code analysis, follow the steps below. If you choose to point to a downloaded baseline, each subsequent run uses the baseline.

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 for use in the Visual Studio Code extension settings. To copy this path:

  1. Open the Polyspace Access web interface.

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

Right-click option to copy project path

Point to Project from Polyspace as You Code

Point to the Polyspace Access project from the Polyspace as You Code extension settings in Visual Studio Code.

  1. Open the extension settings.

    From the Baseline view, hover over Polyspace Access baseline and click Settings icon.

  2. Specify these settings on the User tab:

    • Baseline: Polyspace Access Url: The URL of the server that hosts Polyspace Access. For instance, https://my-access-url:9443/.

  3. Specify these settings on the Workspace tab:

    • Baseline: Project: The path to the project in Polyspace Access that you want to use as baseline. You previously copied this path from the Polyspace Access web interface.

Download Baseline

Download the Polyspace Access results to use as baseline.

  1. Click Download baseline in the Baseline view or open the command palette (Ctrl + Shift + P) and select Polyspace: Download Baseline.

  2. If prompted, allow the extension to sign in using Polyspace Access. Enter the username and password that you use to log in to Polyspace Access. The baseline download begins.

You can view the progress of the download in the Baseline view. See Open Additional Polyspace Views.

After the download is complete, subsequent runs use the baseline. To disable baseline usage, select Show local findings only in the Baseline: Show Baseline Information drop down menu.

The Polyspace as You Code extension stores your Polyspace Access login information. To log out of Polyspace Access, click the Visual Studio Code user icon, point to your Polyspace Access login, and select Sign Out. Polyspace as You Code prompts you to log in to Polyspace Access the next time you download or update a baseline.

Compare Results Against Baseline

When you compare Polyspace as You Code results against a local or Polyspace Access baseline, by default only results that are new compared to the local baseline are shown. If you toggle the baseline filter to show all results, [baseline] appears next to results that appear in the baseline in the Problems panel.

In addition, when you use a Polyspace Access baseline:

  • Results that have a status of No Action Planned, Justified, or Not a Defect are hidden.

  • Results that have a status of Unreviewed, To investigate, To fix, or Other on Polyspace Access carry over all review information to the Result Details view.

    For example, if a defect has been reviewed and assigned a status of To investigate and a severity of Medium, the same review information appears in the Comment from baseline section in the Result Details view.

  • If a Polyspace as You Code result also appears in the Polyspace Access baseline, you can open the project that you use as baseline in the Polyspace Access interface. Click Open project in Access web in the Baseline view. See Open Additional Polyspace Views.

    You can also open the project on Polyspace Access by running Polyspace: Open Project in Access Web from the Command Palette.

If you use both a local baseline and a Polyspace Access baseline, Polyspace compares the current results to the Polyspace Access baseline first, but uses the local baseline to filter for new results.

In order to keep baselines persistent between sessions of Visual Studio Code, Polyspace stores both local and Polyspace Access baselines in your current working directory. If no path is specified in the Polyspace as You Code settings, the extension uses the subfolder polyspace_as_you_code in your system's temp folder.

See Also

Topics