Quality gate: different behaviour between two branches

  • versions used: SonarQube 7.9.3 Developer Edition

  • error observed:

When running an analysis on my development (short-lived) branch, I got this for code coverage:

0.0% Coverage on 7 New Lines to cover
Some Quality Gate conditions on New Code were ignored because of the small number of New Lines
Quality gate result: Passed

After merging the code, I ran the analysis on the master branch and got this:

0.0% Coverage on 7 New Lines to Cover
Quality gate result: Failed

Is there an explanation why the quality gate’s result can be different on the same project between two branches with the same code?


Welcome to the community!

I think your answer is in the messages you posted (emphasis mine):

When you have fewer than 20 new lines, conditions on coverage are ignored. Why? Because it can be a diminishing returns situation when you have to meet a coverage threshold on just a few lines of code. We experienced this ourselves internally, hence the threhold.

When you analyzed the SLB it had too few new lines for the coverage requirement to be tripped. After merge, you cumulatively had more new lines than the threshold, and so the condition was checked and failed.


Thanks for your answer Ann!

But as you can see above, I have the same number of new lines (7) after merge on master branch, so I don’t understand why the conditions on coverage are ignored on some branches but not on all of them.

The behaviour on the development branch seems normal to me, but not the behaviour on the master branch.


How about a screenshot of your failing QG and the conditions on which it failed?


Thanks again for your time Ann, here it is:


Okay, let me start by acknowledging that this is somewhat confusing and arbitrary.

Here’s a subsection of your screenshot:

After merge, you seem to have crossed the threshold of 20 “New Lines” (not 20 New Lines of Code, or 20 New Lines to Cover, but 20 New Lines - blank lines, comments, & all).

And that’s why this condition suddenly turned on.


I can confirm that on my development branch I have:
Duplications on [12] New Lines
less than 20, so it seems to be the explanation, thanks again Ann!

1 Like