简体   繁体   English

Sonar-Gerrit Jenkins插件含糊不清的结果

[英]Sonar-Gerrit Jenkins plugin ambiguous results

I use Gerrit-Sonar plugin in my Jenkins jobs. 我在Jenkins工作中使用Gerrit-Sonar插件。

When I run the job, I get an exact result in the logs, that "n issues were found" and the report was sent to Gerrit. 当我运行这份工作时,我在日志中得到了一个确切的结果,“发现了n个问题”并且报告被发送给Gerrit。 However, when I watch the review in Gerrit, it says that "No issues were found" and review gets a +1 score. 但是,当我在Gerrit观看评论时,它说“没有发现任何问题”,评论获得+1分。

What could be the cause of this behaviour? 可能是这种行为的原因是什么?

I assume this issue is related to your filter settings. 我认为此问题与您的过滤器设置有关。

So, what are the possible reasons of so many issues being ignored? 那么,忽视这么多问题的可能原因是什么?

First, sonar report contains all issues of the project. 首先,声纳报告包含项目的所有问题。

If you have your flag "Report new issues only", then all the issues that are already exist in sonar database will be omitted. 如果您的标记为“仅报告新问题”,则将省略声纳数据库中已存在的所有问题。

Next, flag "Add comments to changed lines only" allows plugin to ignore all issues that belongs to lines of code not changed in current commit. 接下来,标记“仅向更改的行添加注释”允许插件忽略属于当前提交中未更改的代码行的所有问题。 (For example, if sonar database refreshes once a day, all issues created in all commits during that day will be new, but only author of each of them supposed to care - so they are only visible to the author. (例如,如果声纳数据库每天刷新一次,那天在所有提交中创建的所有问题都将是新的,但只有每个人的作者都应该关心 - 因此它们只对作者可见。

Finally, by default only issues with Major (and higher) severity will mark build as failed. 最后,默认情况下,只有严重(和更高)严重性的问题会将构建标记为失败。

You may change filter settings. 您可以更改过滤器设置。 See project Wiki for details on how to do that. 有关如何执行此操作的详细信息,请参阅项目Wiki


This behaviour could also be related to the issue JENKINS-43047 with nested modules. 此行为也可能与JENKINS-43047与嵌套模块的问题有关。 If your project has several nested levels, the path of module component in the exported sonar-report.json is not the full path but the path component of the module. 如果项目具有多个嵌套级别,则导出的sonar-report.json中的模块组件的路径不是完整路径,而是模块的路径组件。 The plugin hasn't process it correctly before the version 1.0.8. 该插件在版本1.0.8之前未正确处理。

Another issue is JENKINS-43730 , if you have 0 project configurations added. 另一个问题是JENKINS-43730 ,如果您添加了0个项目配置。 Add default configuration so your sonar report could be found by plugin 添加默认配置,以便插件可以找到您的声纳报告

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM