如何在 sonarqube 5.0 中使用 git 作为 scm 提供程序(使用 sonar-runner )

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28295261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:44:12  来源:igfitidea点击:

How can I use git as the scm provider in sonarqube 5.0 ( using sonar-runner )

gitsonarqube

提问by Han Jubel

I following the official support of sonarqub http://docs.sonarqube.org/display/SONAR/SCM+support

我遵循声纳的官方支持 http://docs.sonarqube.org/display/SONAR/SCM+support

and I got the error at above.

我在上面得到了错误。

did I miss something need to config, or configure wrong

我是否错过了需要配置的东西,或者配置错误

08:46:33.723 INFO - Sensor SCM Sensor...
08:46:33.897 INFO - SCM provider for this project is: git
08:46:33.898 INFO - Retrieve SCM blame information...
08:46:33.915 INFO - 632 files to be analyzed
08:46:34.377 INFO - Author: PersonIdent[Not Committed Yet, , Tue Feb 3 08:46:34 2015 +0000]
08:46:34.379 INFO - Source commit: null
08:46:34.377 INFO - Author: PersonIdent[Not Committed Yet, , Tue Feb 3 08:46:34 2015 +0000]
08:46:34.924 INFO - Source commit: null
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1:01.699s
08:46:35.891 INFO - Author: PersonIdent[Not Committed Yet, , Tue Feb 3 08:46:35 2015 +0000]
08:46:34.930 INFO - Author: PersonIdent[Not Committed Yet, , Tue Feb 3 08:46:34 2015 +0000]
08:46:35.930 INFO - Source commit: null
Final Memory: 27M/318M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Unable to blame file

thanks very much.

非常感谢。

回答by Fabrice - SonarSource Team

This is because when running an analysis, SonarQube expects that all files should be committed.

这是因为在运行分析时,SonarQube 期望所有文件都应提交。

Indeed, SonarQube assumes that when you run a standard analysis (that pushes data to the server), there should not be any uncommitted changes on a single file of the project, because this would potentially push information that won't be relevant with the real source code on the repository. That's why the analysis will fail.

实际上,SonarQube 假设当您运行标准分析(将数据推送到服务器)时,项目的单个文件上不应有任何未提交的更改,因为这可能会推送与真实数据无关的信息。存储库中的源代码。这就是分析失败的原因。

This is obviously not the case when you run a preview analysis: as this kind of analysis does not push data to the server and only reports issues locally, then it's not a problem to have uncommitted changes and the analysis will therefore not fail.

运行预览分析时显然不是这种情况:由于这种分析不会将数据推送到服务器,而是仅在本地报告问题,因此未提交的更改不是问题,因此分析不会失败。

I've updated the documentationto make this clearer.

我已经更新了文档以使其更清楚。