If you run a Polyspace® analysis as part of continuous integration, each new code submission produces new results. You not only see new results in components that were modified but also in components that depended on the modified components. You can set up e-mail alerts so that component owners get notified when new Polyspace results appear in their components.
To create e-mail notifications:
Export new analysis results to a tab-delimited text file
Apply filters to export specific types of results, for instance, defects with high impact. If required, you can also apply additional filters to the exported files using search and replace utilities. See Export Results for E-mail Attachments.
Send an email with the results file in attachment. For each result, the attachment contains links to open the result in the Polyspace Code Prover™ Access™ web interface.
For instance, if you use an e-mail plugin in Jenkins, you can create a post-build step to send an e-mail after the analysis is complete.
If you use the Polyspace plugin in Jenkins, you can use Polyspace helper utilities for the entire e-mail notification process. See Sample Scripts for Polyspace Analysis with Jenkins
Alternatively, results can be directly assigned to owners based on their file paths. You can set up email notifications that exports a separate results file per owner and sends an email to each owner with the corresponding results file in attachment.
To run this tutorial:
You must have uploaded some result in the Polyspace
Code Prover Access interface. If you complete the tutorial Run Polyspace Code Prover on Server and Upload Results to Web Interface, you should see a folder
testProject on the
PROJECT EXPLORER pane. The folder contains one
To see the results in the project, with
myFirstProject selected, click the
Review button. You see a list of run-time
checks. The Type column shows the color of the
checks. In this tutorial, only red checks will be exported for e-mail
You must be able to interact with the Polyspace
Code Prover Access interface from the command line. For instance, navigate to
polyspace-access login -list-project
Code Prover Server™ installation folder, for instance,
Files\Polyspace Server\R2019a.The variable
the following combination of options. You provide these options with
every use of the
-host hostName -port portNumber -login username -encrypted-password pwd
name of the Polyspace
Code Prover Access web server. For a locally hosted server, use
optional port number of the server. If you omit the port number,
9443 is used.
refer to the
login and an encrypted version of your password. To create an encrypted
Copy the encrypted password and provide this password
with later uses of the
You can export all results in a project or only certain types of results.
Open a command window. Navigate to the folder where you want to export the results.
To export all results, enter the following:
polyspace-access login -export testProject/myFirstProject -output .\result.txt
To export only red checks, enter the following:
polyspace-access login -export testProject/myFirstProject -rte Red -output .\result_red_checks.txt
Open each text file in a spreadsheet viewing utility such as Microsoft®
Excel®. In the first file, you see all defects but in the second file, you
only see the defects with high impact. To see only new defects compared to the
previous analysis of the same project, use the option
You can configure your e-mail utility to send these exported files in attachment.
If required, you can also apply additional filters to the exported files using
search and replace utilities. For instance, use search and replace utilities on the
results file to include results only from specific files and functions. In
Linux®, you can use
retain only results in specific files.
You can assign owners to results in specific files or folders. You can then export one result file per owner and send an email to each owner with the corresponding file in attachment.
You can assign owners in the Polyspace Code Prover Access web interface or at the command line.
In this tutorial, assign all results in the file
jsmith and all results in the file
polyspace-access login -set-unassigned-findings testProject/myFirstProject -owner jsmith -source-contains example.c polyspace-access login -set-unassigned-findings testProject/myFirstProject -owner jboyd -source-contains single_file_analysis.c
After assignment, export one results file per owner.
polyspace-access login -export testProject/myFirstProject -output .\results.txt -output-per-owner
These files contain the exported results:
results.txt contains all results.
results_jboyd.txt contains results assigned to
results.txt.owners.list contains the list of
owners, in this
Before assigning owners to results, use the option
perform a dry run of the assignments. Without performing the assignment, the option
shows the files with results that are assigned and the owner that the results are