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

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

问题描述

   在$分析过程中,我收到以下文件的错误信息 >  [INFO] [22:19:57.714]传感器SCM传感器
[INFO] [22:19:57.715]该项目的SCM提供者是:git
[INFO] [ 22:19:57.715]分析48个文件
[信息] [22:19:58.448]分析了0/48个文件
[警告] [22:19:58.448]缺少以下信息文件:
(snip 48 lines)
[WARN] [22:19:58.449]这可能导致SonarQube中缺失/损坏的功能
[INFO] [22:19:58.449] Sensor SCM传感器(完成)|时间= 735ms

我使用的是SonarQube 5.5,分析是由Maven在Jenkins工作中完成的,多模块Java项目。
安装了Git插件1.2。



在bash shell中,在任何有问题的文件中手动运行git blame,会得到预期的输出。



相关问题我发现所有关于SVN,我的问题与Git。



如何获得Sonarqube上的git blame信息?

解决方案

原因是 JGit bug 。 JGit不支持 .gitattributes 。我有 ident 在我的 .gitattributes 中。简单控制台 git 检出源,在 $ Id $ ident $ c>宏,但是JGit忽略了这一点,并且看到了一个没有提交的区别,实际上并没有提交。



友善的人在 SonarQube邮件列表帮助我,并建议使用 standalone JGit command line distribution

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

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



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

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


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天全站免登陆