Contenuto principale

Visual Studio: 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 Solution Explorer, or right-click in the editor of the file you want to create a baseline for, and select Polyspace > Create a local baseline. You can also create a local baseline by right-clicking a file in the Quality Monitoring view and selecting Create a local baseline.

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®.

  1. Click the Connect to Polyspace Access server icon in the Baseline view. If you have not set up a Polyspace Access URL or login previously, an error message appears. Click Open Setting.

  2. Enter the following information:

    1. Polyspace Access URL — The URL of the server that hosts Polyspace Access, for example, https://my-access-url:9443/.

    2. Polyspace Access Login — The username that you use to log in to Polyspace Access.

  3. Click Connect. In the prompt that appears, enter the password associated with the username you entered in the previous step. You can choose to remember this password for automatic login in the future.

On a successful sign-in, the Project paths section populates showing every project Polyspace as You Code can identify in your Polyspace Access server. The Baseline view displays the full server URL alongside the status Connected.

To close the connection to Polyspace Access, click the Disconnect from Polyspace Access server icon . The Polyspace Access URL you connected to is saved in the setting Polyspace Access URL. Polyspace as You Code attempts to log into this Polyspace Access server if you click the Connect to 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, disconnect from the current Polyspace Access server then replace the URL from the setting Polyspace Access URL as well as the username in the Polyspace Access Login setting.

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. The Project paths section populates showing every project Polyspace as You Code can identify in your Polyspace Access server.

To add a project as a baseline:

  • Select a project path or group of project paths in the left-side pane of the Project paths section.

  • Click the arrow icon to move the selected projects into the right-side pane.

Selection of Polyspace Access projects to use as a baseline.

You can select multiple projects by using CTRL + click or select a group of projects using Shift + click. Filter the project path list by using the search box. Move every project in the left-side pane to the right-side pane by clicking the double arrow icon.

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 view under Polyspace Access baselines. Click the Configure settings to use baselines icon to add additional baselines.

To remove a baseline from Polyspace as You Code, right-click the baseline you want to remove in the Baseline view and select Remove Access baseline. Alternatively, from the Project paths section, move a project from the right-side pane to the left-side pane to remove it as a baseline.

Download Baseline

Download the Polyspace Access results to use as baseline. Click the Download all baselines icon in the Baseline view to download the baseline for all configured Polyspace Access projects.

If you do not want to download every baseline you have connected from Polyspace Access, you can download baselines individually. Right-click the baseline you want to download in the Baseline view and select Download Access Baseline. Baselines that are have never been downloaded show with the Never downloaded baseline icon icon in the Baseline view. Downloaded baselines show with the Downloaded baseline icon 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, the status of the baseline is unknown and the baseline cannot be used during analysis. 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 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. Right-click the baseline in the Baseline view and select Open project in Polyspace Access.

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, click the Configure settings to use baselines icon to open the baseline options. Select the project you want to reorder in the right side of the Project paths pane, then use the up and down arrows to move the project to the desired location in the list of projects.

In order to keep baselines persistent between sessions of Visual Studio, 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