Sonarqube: Missing blame information for the following files
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 fails to get git blame information from Jenkins project
Based on @CSchulz's answer I found the solution using SonarQube module
I configured SonarQube to use two submodule corresponding to my A
and B
git projects. Each project get the name of git module as the important projectBaseDir
parametre.
sonar.projectKey=P
sonar.projectName=P
sonar.projectVersion=4.0.0
sonar.binaries=.
sonar.cxx.includeDirectories=Common/Path
sonar.cxx.cppcheck.reportPath=cppCheckReport.xml # Reports are present in A and B forlder
# 2 modules definition
sonar.modules=A,B
# Module A
IHM.sonar.projectBaseDir=A
IHM.sonar.projectName=A
IHM.sonar.sources=.
IHM.sonar.cxx.includeDirectories=XXX
# Module B
Shares.sonar.projectBaseDir=B
Shares.sonar.projectName=B
Shares.sonar.sources=.
Shares.sonar.cxx.includeDirectories=XXX
I needed to figure out some configurations but it works and it is fine for me.
SonarQube 5.6 using Jazz RTC plugin 1.1 missing blame information
Fixed in SonarQube version 5.6.7
Ignoring blame result since provider returned 120 blame lines but file something.java has 226 lines for CVS Sonar
CVS will always blame the remote content of the file, so one explanation could be that you have local modifications to the file.
Also cvs annotate
returns information from server for the given file in HEAD revision. If you are working on a branch you have to manually pass the branch using -Dsonar.cvs.revision=xxxx
command line argument to the scanner.
Related Topics
Find Maximum Score or the Maximum Average Score of Candidate Scores Given in Two Dim Array
How to Specify the Required Java Version in a Gradle Build
How to Autowire a Component Which Is Having Constructor With Arguments in Springboot Application
Launching Spring Application Address Already in Use
How to Upload a Document to Sharepoint With Java
Using an Empty Keystore Password Used to Be Possible
Passing Data into HTML from Java Via Spring
How to Return Different Results When Calling the Same Mocked Method
Org.Hibernate.Annotationexception: @Onetoone or @Manytoone on <Entity> References an Unknown Entity
Method Does Not Override Method from Its Superclass . Android Fragment
How to Check Heap Usage of a Running Jvm from the Command Line
Spring Boot API Call With Multiple @Requestparam
Java.Io.Filenotfoundexception: the System Cannot Find the File Specified
Refactor Multiple If' Statements in Java-8
How to Get the Path of Src/Test/Resources Directory in Junit