Main Content

Set Baseline Polyspace as You Code Results in Visual Studio Code

For more efficient bug fixing, you can baseline the results of a Polyspace as You Code analysis using 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™.

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 3: Download Baseline.

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

What Baseline Results Look Like

If you baseline Polyspace as You Code results using Polyspace Bug Finder Server results that you downloaded from Polyspace Access, you can see the following benefits:

  • Results that have a justified Status on Polyspace Access (No Action Planned, Justified, or Not a Defect) are no longer shown.

  • Results that have a non-justified Status on Polyspace Access carry over all review information to the RESULT DETAILS view.

    For instance, the Write without a further read defect below is also present in the baseline. In Polyspace Access, the defect has been reviewed and assigned a Status of To investigate and a Severity of Medium. This review information appears in the Comment from baseline section in the Result Details view. The word [baseline] also appears next to the result in the Problems pane.

    Problems panel and result details view

    If a Polyspace as You Code result also appears in the baseline, you can open the project that you use as baseline in the Polyspace Access interface. Click Open basline in Access UI 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 specify Show local findings only in the Baseline: Show Baseline Information Polyspace as You Code extension setting, you see only results that are new in the current run. That way, you can only focus on results that explicitly occurred because of the changes you made since the last Polyspace Server run.

Setting Baseline Steps

To use Polyspace Bug Finder Server results as baseline for a Polyspace as You Code analysis, follow the steps below. Once a baseline is downloaded, if you choose to point to the baseline, each subsequent run, whether on file save or on-demand, uses the baseline.

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 for use in the Visual Studio Code extension settings. 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: Refer to Project from Polyspace as You Code

Next, refer to the Polyspace Access project from the Polyspace as You Code extension settings in Visual Studio Code.

  1. Open the extension settings.

    To open the baseline settings, press Ctrl + , (comma) and type polyspace.baseline in the settings search bar.

  2. Specify these settings on the User tab:

    • Baseline: Polyspace Access Login: The username that you use to log in to Polyspace Access.

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

    Polyspace as You Code extension settings for getting baseline

  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.

    • Baseline: Show Baseline Information: Select an option from the dropdown.

      • Show local findings only — Do not use the baseline.

      • Show local findings and baseline info — After you download a baseline, findings that are already justified in the baseline run are suppressed in the PROBLEMS panel.

      • Show new findings only — After you download a baseline, findings that are already present in the baseline run are suppressed in the PROBLEMS panel. Use this option to focus on only new findings in your file.

Step 3: Download Baseline

Explicitly download the Polyspace Access result 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. Enter the 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 download, subsequent runs use the baseline. To disable baseline usage, select Show local findings only in the Baseline: Show Baseline Information drop down menu.

Related Topics