Visual Studio Code: Configure Baseline Results in Polyspace as You Code
For more efficient bug fixing, compare your Polyspace® as You Code™ single-file analysis results against a set of baseline results so you can focus on new or unreviewed results only. You can create a local baseline or download a Polyspace Bug Finder™ analysis from Polyspace Access™ to use as a baseline.
Use baselines generated by the same version of Polyspace that you use with your Polyspace as You Code analyses. If you use a baseline from a different version of Polyspace, the baseline might not contain the same results as your analysis from Polyspace as You Code. Polyspace as You Code displays a warning if you are using a baseline from a different version of Polyspace. Using the results of a Polyspace Code Prover™ analysis as a baseline is not supported.
Note
To keep using the most up-to-date baseline, periodically update your baselines by downloading the latest results from Polyspace Access. See Download Baseline.
Configure Local Baseline
A local baseline is a snapshot of the Polyspace results associated with a local file. You can compare your current results against the local baseline to see what has changed and verify that no new issues are being introduced.
To create a local baseline, right-click a file in the Explorer
pane, or right-click in the editor of the file you want to create a baseline for, and
select Create a local baseline. You can also create a local
baseline by clicking the Create a local baseline icon
next to the file in the Quality
Monitoring pane.
Configure Polyspace Access Baselines
A Polyspace Access baseline is sourced from a Polyspace Access project containing Polyspace Bug Finder analysis results of your local file. Polyspace as You Code must be connected to Polyspace Access to use the baseline.
In order to configure a Polyspace Access baseline, you must have a Polyspace Access server login name and password along with an uploaded run of project results. The project must contain results from an analysis of the same file you are analyzing in Polyspace as You Code. Downloading a baseline from Polyspace Access requires a Polyspace Access license.
Configure Polyspace Access
Before you can download a Polyspace Access baseline, you need to configure your Polyspace Access server information in Visual Studio Code.
Click the Connect to a Polyspace Access server icon
in the Baseline
pane.Enter the URL to your Polyspace Access server in the search bar. For example:
https://my-access-url:9443/.Sign into Polyspace Access. Click Allow if prompted by Visual Studio Code, then enter your username and password for your Polyspace Access server.
On a successful sign-in, the Baseline pane shows Polyspace Access baselines Connected . If this is the initial configuration, Polyspace as You Code shows a dropdown of every project Polyspace as You Code can identify in your Polyspace Access server. Select the checkbox next to each project you want to download as a baseline.
To close the connection to Polyspace Access, click the Disconnect from a Polyspace
Access server icon
. The Polyspace Access URL you connected to is
saved in the workspace setting Baseline: Polyspace Access Url.
Polyspace as You Code attempts to log into this Polyspace Access server if you click
the Connect to a Polyspace Access server icon
. If you are connected to a Polyspace Access
server when you close the IDE, upon reopening the same IDE later, Polyspace
as You Code automatically attempts to reconnect to the same Polyspace Access
server. To connect to a different Polyspace Access server, remove the URL from the
workspace setting Baseline: Polyspace Access Url and then click
the Connect to a Polyspace Access server icon
.
Select Projects to Use As Baselines
After you configure your connection to Polyspace Access, you can select which Polyspace Access projects to use as baselines.
Click the Select projects to use as results baselines icon
. A dropdown appears showing every
project Polyspace
as You Code can identify in your Polyspace
Access server. Polyspace displays projects by name followed by
project path.Select the checkbox next to each project you want to download as a baseline. Type to filter for specific projects by name. Projects you select before filtering stay selected while the filter is applied.

Click OK after you have selected all the projects you want to
use as a baseline. Polyspace displays each baseline you selected in the
Baseline pane under Polyspace Access
baselines. Click the Select projects to use as results baseline icon
to add additional baselines.
Projects you connect to Polyspace as You Code from Polyspace Access can also be added using the workspace setting Baseline: Projects from within Visual Studio Code. You must know the project path to add a baseline from this setting. To view a project path in Polyspace Access:
Open the Polyspace Access web interface.
On the Project Explorer pane, right-click the project and select Copy Project Path to Clipboard.
To remove a baseline from Polyspace
as You Code, hover over the baseline you want to remove in the
Baseline pane and select the Remove Access baseline icon
. Alternatively, remove projects from the
workspace setting Baseline: Projects by hovering over the
baseline you want to remove and clicking the Remove Item icon
. This removes the project as a baseline.
Download Baseline
Download the Polyspace
Access results to use as baseline. Click the Download all Access Baselines
icon
next to Polyspace Access
baselines to download the baseline for all configured Polyspace
Access projects. Alternatively, open the command palette (Ctrl +
Shift + P) and select Polyspace:
Download all Access Baselines.
If you do not want to download every baseline you have connected from Polyspace
Access, you can download baselines individually. Hover over the baseline you want to
download in the Baseline pane and select the Download Access Baseline icon
.
Polyspace as you Code monitors your baselines to verify the run ID of the baseline
matches the latest run ID in Polyspace Access. You can hover over a baseline to view
details such as the run ID the baseline uses and the status of the baseline.
Baselines that have never been downloaded or are outdated appear in yellow text in
the Baseline pane. Baselines that are outdated also display the
outdated icon
in the Baseline pane. If you
are disconnected from Polyspace Access, no Polyspace
Access show in the Baseline pane. To keep using the most
up-to-date baseline, periodically update your baselines by downloading the latest
results from Polyspace Access. Click the Download all Access Baselines icon
any time you want to update your baseline with
the latest results.
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 in the Problems pane next
to results that also appear in the baseline.
In addition, when you use a Polyspace Access baseline:
Results that have a status of
No Action Planned,Justified, orNot a Defectare hidden.Results that have a status of
Unreviewed,To investigate,To fix, orOtheron Polyspace Access carry over all review information to the Result Details pane.For example, if a defect has been reviewed and assigned a status of
To investigateand a severity ofMedium, the same review information appears in the Comment from baseline section in the Result Details pane.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 the Open Project in Access Web icon
in the Baseline
pane.You can also open the project on Polyspace Access by running Polyspace: Open Project in Access Web from the command palette.
Hover over a file in the Quality Monitoring list to view which local or Polyspace Access baselines are associated with that file. If a Polyspace Access baseline is associated with the file, the name of the Polyspace Access project the baseline is from is displayed. If multiple Polyspace Access baselines contain the file that is in the Quality Monitoring list, Polyspace as You Code takes into account the order of the Polyspace Access baselines in the Baseline pane.
The first baseline in the Polyspace Access baselines section that contains the file in
the Quality Monitoring list is linked to that file. To reorder
these baselines in Visual Studio Code, open the settings.json file
for the baseline settings and manually reorder the projects. To open the
settings.json file for the baseline settings, click the Configure
settings icon
in the Baseline pane and then
select the Open Settings (JSON) icon in the Settings pane.
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 you do not specify a path
for your baselines in the Polyspace
as You Code settings, the extension uses the subfolder
polyspace_as_you_code in your system temp
folder.