Main Content

Compare Results in Polyspace Access Project to Previous Runs and View Trends

When you open Polyspace® analysis results in the Polyspace Access Dashboard or REVIEW, you see a snapshot of the most recent run that was uploaded to the project. To view a snapshot from an earlier run, select that run from the Current run drop-down list.

Polyspace Access dashboard active run selection.

Select a previous run to see the state of your project from a few submissions ago. For instance, you might want to investigate a spike in findings in a previous version of your project. When you view an older project run in the Dashboard or REVIEW views, all the information for the currently selected run is displayed, except:

  • The Quality Objectives settings and the Review History pane show the same information no matter which run you select.

  • You cannot edit the Result Details fields if the selected run is not the latest run.

If you share a finding URL from an older run, the Polyspace Access interface opens that finding in the most recent version of the project. If the finding is not present in the most recent run, through the interface, you can open the finding in the older run.

Comparison Mode in the Polyspace Access Interface

To compare two runs in from the same project in the Polyspace Access™ interface, on the toolstrip, select a Current run and a Baseline run. Check that the Baseline checkbox is enabled. You can compare current runs to only older baseline runs.

Polyspace Access dashboard comparison mode

In the Dashboard view, the comparison shows a summary of statistics for each run and details of the number of findings that are:

  • Resolved — Findings from the baseline run that are Done in the current run, or findings that are not in the current run because they are Fixed.

    • Findings are Done if they have a status of Justified, No Action Planned, or Not A Defect.

    • Findings are Fixed if they are fixed in the source code or the source code containing the finding is deleted or no longer part of the analysis.

    Resolved findings from a previous run can show as New findings in a later run if you change the syntax of the code. This can occur even when the semantics of the code have not changed as a result of the syntax change.

    For instance, in the following example, a previous run contains a finding that you marked as Justified, which labels the finding as Resolved in Polyspace. In Run 13, the code changes to have ARRAY_SIZE 3. Although the line where the violation occurs has not changed, Polyspace shows a New finding at the same location as the Resolved finding due to the ARRAY_SIZE change.

    Two screenshot examples of Polyspace Access runs. The left image shows the Justified result. The right image shows the New result due to the ARRAY_SIZE 3 code change.

    If you annotate your code to justify the finding, Polyspace does not mark the finding as New.

  • New — Findings that are in the current run but not in the baseline run.

  • Unresolved — Findings that are in the baseline run and the current run.

The comparison mode is not available for the Code Metrics and Quality Objectives dashboards.

Click a cell in the Details table to open the corresponding results in the Results List.

  • The total number of findings displayed in the Results List corresponds to the findings from the Current run and the findings from the Baseline run that are Fixed in the Current run.

  • If a finding is Resolved, the interface displays the Source Code and Result Details information from the Baseline run.

In the REVIEW view, in addition to Resolved, New, and Unresolved, you can filter findings by Fixed. These findings are no longer in the current run because they are fixed, or the source code containing the findings is deleted or no longer part of the analysis.

To turn off the comparison mode, deselect the Baseline checkbox or select None in the Baseline drop-down list.

Comparison Mode at the Command Line

To compare two runs from the same project at the command-line, use the polyspace-access -export command and specify the run ID of a current run, the run ID of an earlier run that you use as a baseline, and the resolution type that you want to use for the comparison.

When you specify a baseline to compare with the current run, the run ID that you specify for the baseline run must exist and must point to a run in the same project as the current run.

The command generates a file with a list of findings filtered by one of these resolution types:

  • New — Findings that are in the current run but not in the baseline run.

  • Fixed — Findings that are fixed in the current run, either because the finding was fixed in the source code, or because the source code containing the finding is deleted or no longer part of the analysis.

  • Unresolved — Findings from the baseline run that are still present in the current run.

  • Resolved — Findings that are Fixed in the current run or findings with a status of Justified, No Action Planned, or Not A Defect in the current run.

For example, to compare the latest run of project public/Bug_Finder_Example(Bug Finder) to an earlier run:

  1. Use the polyspace-access -list-runs to obtain the run IDs of the runs that you want to compare:

    polyspace-access $login -list-runs "public/Bug_Finder_Example(Bug Finder)"
    
    Connecting to https://example-access-server:9443
    Connecting as jsmith
    PROJECT_PATH "public/Bug_Finder_Example(Bug Finder)" RUN_ID 28 
    PROJECT_PATH "public/Bug_Finder_Example(Bug Finder)" RUN_ID 29 
    PROJECT_PATH "public/Bug_Finder_Example(Bug Finder)" RUN_ID 30 
    PROJECT_PATH "public/Bug_Finder_Example(Bug Finder)" RUN_ID 124 
    PROJECT_PATH "public/Bug_Finder_Example(Bug Finder)" RUN_ID 125 
    Here, $login is a variable that stores the login credentials and other connection information. To configure this variable, see Encrypt Password and Store Login Options in a Variable.

  2. Use the command polyspace-access -export and specify:

    • The run ID of a current run.

    • The run ID of an earlier run that you use as a baseline.

    • The resolution type that you want to use a as a filter.

    For instance, to compare the last run (run ID 125) to the second run (run ID 29) and export findings that are Fixed, enter this command:

    polyspace-access $login -export 125 -baseline 29  -resolution Fixed -output ./diff_fixed.txt 
    
    Connecting to https://example-access-server:9443
    Connecting as jsmith
    Exporting results from RunId 125 and comparing to RunId 29
    Command Completed
    The command exports the list of findings that are fixed in the current run compared to the baseline run to file diff_fixed.txt.

You cannot specify more than one resolution type when you execute the command. To compare project runs for multiple resolution types, run the polyspace-access -export command for each resolution type.

Related Topics