Sonarqube: Missing blame information for the following files

We Are Going To Discuss About Sonarqube: Missing blame information for the following files. So lets Start this Java Article.

Sonarqube: Missing blame information for the following files

Advertisements
  1. 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.

  2. 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.

Solution 1

Advertisements

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

Original Author Amedee Van Gasse Of This Content

Solution 2

Advertisements

I ran into this issue with a build that stopped working after a Sonar upgrade.

The problem for me was that the Jenkins job was configured to do a Shallow Clone when pulling from git. This does not pull in enough history so Sonar 5.6.6 could not do an analysis because blame information was not included in the shallow copy. I used the -X option when running Sonar to view the actual commit number that it was choking on.

I’m my case I simply unchecked the shallow copy check box and BAM, it worked again (though more slowly)!
enter image description here

Original Author neoscribe Of This Content

Solution 3

Advertisements

I had a similar issue: a file in my project was created during the build process and was not stored in source control. In my case it was api.json.

Within the SonarQube runner build step in Team City I added this file to the exclusions within the additional parameters

-Dsonar.exclusions=**/spec/api.json

and the error disappeared.

Original Author John Meyer Of This Content

Solution 4

Advertisements

There is another solution for this case that solved my problem.
If you are in a company or corporate location you must log into the artifact repository for the docker to start
Example

$ docker login artifactory.companyname.corp

After that the docker will ask for your corporate user and password
and the issue is resolved

Original Author Jorge Trindade Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment