在 SonarQube 分析期间,我收到警告 Missing blame information for the following files
。
[INFO] [22:19:57.714] Sensor SCM Sensor
[INFO] [22:19:57.715] SCM provider for this project is: git
[INFO] [22:19:57.715] 48 files to be analyzed
[INFO] [22:19:58.448] 0/48 files analyzed
[WARN] [22:19:58.448] Missing blame information for the following files:
(snip 48 lines)
[WARN] [22:19:58.449] This may lead to missing/broken features in SonarQube
[INFO] [22:19:58.449] Sensor SCM Sensor (done) | time=735ms
我正在使用 SonarQube 5.5,分析是由 Maven 在 Jenkins 工作中在一个多模块 Java 项目中完成的。安装了 Git 插件 1.2。
在 bash shell 中对任何有问题的文件手动运行 git blame 会得到预期的输出。
我发现的相关问题都是关于 SVN 的,我的问题是 Git。
我如何在 Sonarqube 上获取 git blame 信息?
原文由 Amedee Van Gasse 发布,翻译遵循 CC BY-SA 4.0 许可协议
原因是 JGit 错误。 JGit 不支持
.gitattributes
。我有ident
在我的.gitattributes
。普通控制台git
检查了源代码,应用了ident
在$Id$
宏,但是 JG不是一个。SonarQube 邮件列表 上的友好人员帮助了我,并建议使用 [独立的 JGit 命令行分发](http://docs.sonarqube.org/display/PLUG/Git+Plugin#GitPlugin-Howtoinvestigateerrorduringblame(onlypossibleonUnix/Linux) 进行调试:
这个特殊的 JGit 错误已经 5 年多没有解决了,我不希望它会很快解决,所以我从我所有的来源中删除了
$Id$
宏。这是我使用的 (Bash) 代码,用于删除所有
$Id$
宏: