The Overview tab shows that quality gate has passed, while it should fail if Coverage on New Code is < 70%. The Metrics frame shows “0 new lines to cover” while lots of new lines have been added.
Going into the Measures tab, and into a file where untested code was added:
The new code is clearly identified as Not covered by tests (as displayed when hovering on red bars).
Why doesn’t this new untested code fall into the category New lines to cover ?
What is missing here for the quality gate to fail ?
It looks like what you’re calling the new code isn’t actually considered new code by SonarQube. What do you see if you expand the “Size” measure in the Measures tab? Are any lines reported as new and does it match your expectation?
You may have a New Code Period setting that isn’t aligning well with your analysis usage.
Can you clarify which edition of SonarQube you’re running? Looks like it’s Developer Edition possibly.
Now that we know it’s a short-lived branch or Pull Request branch being analyzed, yes, this warning can very much be related to your lack of new code. The state of the local checkout needs to cleanly contain the head revision for the branch (not be in any kind of preview merge state) and also contain the full ref for the target branch. Depending on your CI, it may be possible to specify the checkout behavior to include the ref or you can do it manually with something like: git fetch --no-tags ${GIT_URL} +refs/heads/master:refs/remotes/origin/master