主要内容

发送电子邮件通知Polyspace代码箴言结果

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.

创建电子邮件通知

要创建电子邮件通知:

  1. Export new analysis results to a tab-delimited text file (。tsvformat).

    应用过滤器以导出特定类型的结果,例如具有高影响力的缺陷。如果需要,您还可以使用搜索和替换实用程序将其他过滤器应用于导出的文件。看到电子邮件附件的导出结果

  2. 发送电子邮件与附件中的结果文件。对于每个结果,附件包含要打开结果的链接Polyspace Code Prover™ Access™Web界面。

    例如,如果在Jenkins中使用电子邮件插件,则可以在分析完成后创建一个Build-Build步骤以发送电子邮件。

If you use the Polyspace plugin in Jenkins, you can use Polyspace helper utilities for the entire e-mail notification process. SeeJenkins的PolySpace分析示例脚本

或者,可以基于其文件路径直接分配给所有者的结果。您可以设置每位所有者的单独结果文件的电子邮件通知,并在附件中使用相应的结果文件向每个所有者发送电子邮件。

Prerequisites

To run this tutorial:

  • You must have uploaded some result in thePolySpace代码抄本访问interface. If you complete the tutorial在服务器上运行PolySpace代码箴言并将结果上传到Web界面,你应该看到一个文件夹testProject在这一点项目资源管理器pane. The folder contains one projectmyFirstProject

    To see the results in the project, withmyFirstProject选择,单击Review按钮。您可以看到运行时检查列表。该类型column shows the color of the checks. In this tutorial, only red checks will be exported for e-mail attachments.

  • You must be able to interact with thePolySpace代码抄本访问来自命令行的接口。例如,导航到polyspaceserverroot\ polyspace \ bin和enter:

    PolySpace-Access.登录-list-project

    Here.polyspaceserverroot是个PolySpace Code Prover Server™installation folder, for instance,C:\Program Files\Polyspace Server\R2020b。变量登录refers to the following combination of options. You provide these options with every use of thePolySpace-Access.command.

    -主办hostName-portportNumber-登录username-encrypted-passwordPWD

    Here,hostName是个name of thePolySpace代码抄本访问web server. For a locally hosted server, uselocalhost.portNumber是个optional port number of the server. If you omit the port number,9443用来。usernamePWDrefer to the login and an encrypted version of your password. To create an encrypted password, enter:

    PolySpace-Access -encrypt-password

    复制加密密码并随后使用此密码PolySpace-Access.command.

电子邮件附件的导出结果

您可以将所有结果导出在项目中或某些类型的结果中。

打开命令窗口。导航到要导出结果的文件夹。

  • To export all results, enter the following:

    PolySpace-Access.登录出口testProject / myFirstProject -output .\result.txt

  • To export only red checks, enter the following:

    PolySpace-Access.登录出口testProject / myFirstProject -rte Red -output .\result_red_checks.txt

Open each text file in a spreadsheet viewing utility such asMicrosoft®Excel®。在第一个文件中,您可以看到所有结果,但在第二个文件中,您只能看到红色运行时检查。代替-rte Red,您可以应用其他过滤器。

  • To see only new results compared to the previous analysis of the same project, use the option-new-findings

  • To apply a more fine-grained set of filters, you can use software quality objectives (SQOs). The software quality objectives are specified through a progressively stricter set of SQO levels, numbered from 1 to 6. You can customize the requirements of each level in the Polyspace Access web interface, and then use the option-open-findings-for-sqo使用级别编号仅导出必须审查的结果以满足要求。也可以看看软件质量目标(Polyspace Code Prover Access)

To see all filtering options, enter:

PolySpace-Access.-h -export

You can configure your e-mail utility to send these exported files in attachment.

如果需要,您还可以使用搜索和替换实用程序将其他过滤器应用于导出的文件。For instance, use search and replace utilities on the results file to include results only from specific files and functions. In Linux®, you can usegrepsedto retain only results in specific files.

Assign Owners and Export Assigned Results

您可以分配所有者以导致特定文件或文件夹。然后,您可以将一个结果文件输出每个所有者并将电子邮件发送到每个所有者的附件中的每个所有者。

You can assign owners in thePolySpace代码抄本访问web interface or at the command line.

In this tutorial, assign all results in the fileexample.ctojsmith所有结果都在文件中single_file_analysis.c.toJBOYD.

PolySpace-Access.登录-set-unassigned-findings testProject/myFirstProject -owner jsmith -source-contains example.c polyspace-access登录-set-unassigned-speimes testproject / myfirstproject -owner jboyd -source-contains stilling_file_analysis.cn

分配后,每位所有者导出一个结果文件。

PolySpace-Access.登录出口testProject / myFirstProject -output .\results.txt -output-per-owner

该se files contain the exported results:

  • results.txtcontains all results.

  • results_jsmith.txtresults_jboyd.txt包含分配的结果jsmithJBOYD.respectively.

  • results.txt.owners.listcontains the list of owners, in this case:

    JSMITH JBOYD.

在将所有者分配给结果之前,请使用该选项-dryrun执行任务的干燥运行。如果不执行赋值,则该选项显示具有分配结果的文件以及将结果分配给的所有者。

看到Also