Main Content

Run and Review Results in Polyspace as You Code for Visual Studio

After you configure the Polyspace as You Code plugin, you are ready to run an analysis and fix or justify any findings. Before continuing this guide, confirm you have added the files example.hpp and example_source.cpp to the Quality Monitoring list.

Run Polyspace as You Code Analysis in Visual Studio

You can run an analysis in these ways:

  • If you select Start analysis on save, save your edited file to run an analysis.

  • Right-click in the file editor with your file open and select Polyspace > Run Polyspace Analysis.

  • Manually add your file to the Quality Monitoring list and click the Run analysis icon in the Quality Monitoring view to analyze your file.

 Manually Run Analysis

View, Fix, or Justify Findings

After Polyspace runs the analysis, the filename in the Quality Monitoring view is green if there are no findings and red if there are findings. A number to the right of the filename indicates the number of findings.

View a list of your findings in the Error List view, which opens by default when you open the Polyspace as You Code windows in Visual Studio®. If the Error List is not open, reset the perspective by clicking Extensions > Polyspace > Open Polyspace Windows.

Use the filter in the Error List to search for specific findings. Each finding contains a filename and line number to indicate where the finding exists in your code.

After you run an analysis on the example code:

  1. Open the results in the Error List.

  2. In the search bar, enter the text A16-2-3. There is one result on line five.

    Error List pane in Visual Studio with A16-2-3 filter enabled

  3. Click the finding in the Error List to open the file that contains the finding.

    Each finding is noted in the file with a red highlight. Click the highlighted sections of code to see a list of each finding associated with the problem in the Result Details.

  4. In the example code, add this #include statement on line two:

    #include <cstdint>

  5. Save this change and run another analysis. The A16-2-3 error on line five is no longer present.

If you set up automatic analysis, you can find and fix findings during the code authoring process. Each time you save changes, a Polyspace analysis begins in the background and displays any new findings or removes fixed findings from the list.

 View and Fix Findings

Justify Individual Findings

You can justify a finding from the Error List or from the location of the finding in the code.

Right-click a finding in the Error List and select Polyspace > Justify the current result. This adds a comment to your code, which you can amend. Adding a justification removes the finding from the Error List. To show the finding again, remove the justification comment and perform an analysis.

 Justify Findings

View Header Findings

When you analyze source files, you see any header file findings in the Error List. If a header contains any findings, the findings are noted with a red H next to the source file in the Quality Monitoring list.

Click a header finding in the Error List to navigate to the header file that contains the finding. The source file analysis that caused the header finding is listed in the Description column of the Error List.

 View Header Findings