Last analysis had 1 warning, could not find ref

Sonar version: Developer Edition 7.9.6

Hello, I set up Sonarqube for PR analysis and each PR analysis has this warning:

Screenshot 2021-08-30 at 11.28.10

Could not find ref `xyz’ in refs/heads, refs/remotes/upstream or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.

What does it mean? Does it mean that I should attach a script to fetch all branches (especially target) to my CD before running Sonarqube commands?

I am asking because it may cause my next issue, which is 0 code coverage on 0 new lines despite the fact that I add new lines and some of them are covered and some of them are not.

Screenshot 2021-08-30 at 11.29.10

PR: I use gradle and Android environment.

Hey there.

Typically, this message is the result of doing a shallow (partial) clone where, as you’ve noted, all branches are not available. At the very least, the target branch needs to be available so that a diff can accurately be done (and the PR will show the changed lines).

Make sure the target branch is fetched, or a full clone is performed, and you should be good to go. I also anticipate that accurately detecting changed lines will fix your other issue: