Sonarqube:缺少以下文件的责备信息 [英] Sonarqube: Missing blame information for the following files

查看:144
本文介绍了Sonarqube:缺少以下文件的责备信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SonarQube 分析期间,我收到警告 Missing blame information for the following files.

[INFO] [22:19:57.714] 传感器 SCM 传感器[INFO] [22:19:57.715] 这个项目的 SCM 提供者是:git[INFO] [22:19:57.715] 48 个文件待分析[INFO] [22:19:58.448] 分析了 0/48 个文件[警告] [22:19:58.448] 缺少以下文件的责备信息:(剪断48行)[警告] [22:19:58.449] 这可能会导致 SonarQube 中的功能丢失/损坏[信息] [22:19:58.449] 传感器 SCM 传感器(完成)|时间=735ms

我正在使用 SonarQube 5.5,分析由 Maven 在 Jenkins 作业中对多模块 Java 项目完成.Git 插件 1.2 已安装.

在 bash shell 中对任何有问题的文件手动运行 git blame 会产生预期的输出.

我发现的相关问题都是关于 SVN,我的问题是 Git.

如何获取有关 Sonarqube 的 git blame 信息?

解决方案

原因是 JGit 错误.JGit 不支持 .gitattributes.我有 ident在我的 .gitattributes 中.普通控制台 git 检查了源代码,在 $Id$ 宏上应用了 ident,但随后 JGit 忽略了这一点,并看到了一个不存在的差异承诺,实际上没有.

SonarQube 邮件列表上的友好人士帮助了我,并建议使用 独立 JGit 命令行分发版:

chmod +x/where/is/org.eclipse.jgit.pgm-<version>-r.sh/where/is/org.eclipse.jgit.pgm-<version>-r.sh blame -w/path/to/offending/file

这个特殊的 JGit 错误已经超过 5 年没有得到解决,我不希望它会很快得到解决,所以我从所有来源中删除了 $Id$ 宏.p>

这是我用来删除所有 $Id$ 宏的 (Bash) 代码:

找到 */src -name "*.java" |xargs -n 1 sed -i '/$Id.*$/d'查找 */src -name "*.java" |xargs 混帐添加git commit -m "删除 $Id$ 宏"git 推送

I am getting the warning Missing blame information for the following files during analysis by SonarQube.

[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

I am using SonarQube 5.5, analysis is done by Maven in a Jenkins job, on a multi-module Java project. Git plugin 1.2 is installed.

Manually running git blame in a bash shell, on any of the offending files, gives an expected output.

Related questions I found were all about SVN, my issue is with Git.

How do I get git blame information on Sonarqube?

解决方案

The cause was a JGit bug. JGit does not support .gitattributes. I had ident in my .gitattributes. Plain console git checked out the source, applied ident on $Id$ macros, but then JGit ignored that and saw a difference that wasn't committed, where there actually wasn't one.

The friendly people on the SonarQube mailing list helped me out, and suggested debugging with the standalone JGit command line distribution:

chmod +x /where/is/org.eclipse.jgit.pgm-<version>-r.sh
/where/is/org.eclipse.jgit.pgm-<version>-r.sh blame -w /path/to/offending/file

This particular JGit bug has not been solved for over 5 years and I have no hope that it will be solved anytime soon, so I removed the $Id$ macros from all my sources.

This is the (Bash) code I used, to remove all $Id$ macros:

find */src -name "*.java" | xargs -n 1 sed -i '/$Id.*$/d'
find */src -name "*.java" | xargs git add
git commit -m "Remove $Id$ macros"
git push

这篇关于Sonarqube:缺少以下文件的责备信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆