New code coverage is 0 even when there is no code change

Hi we are using sonarqube develop 7.5 version.
Two of our project recently are failed for new code coverage is 0.
But we only updated the library version number, no new code at all.
From the overview, coverage on new code shows ‘-’ , but Quality Gate turned to red as ‘failed’ .

Is this the expected behavior or there is a bug ?
Looking forward to your help!

Thanks!

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Hi,

This is difficult to visualize. Could you provide some screenshots?

 
Thx,
Ann

Hi Ann,

I attached the screeshots. This is one of our library, we only update version number this time (1.2.29 -> 1.2.30) . No new code check in at all, but quality gate still try to detect new code coverage and status is failed.

Is there a way we can change config to fix this ?

Thank you!

Meng

20%20AM

Detail of code coverage.

Thanks,
Meng

Also found another project we just checked in new code, in the overview page, quality gate is failed for the coverage number is incorrect. The real new code coverage is 93.2 which line coverage is 94.7% and condition coverage is 83.3%. But quality gate shows 1.4% and 2.7% respectively.

Here is the detail.

Thanks for your help!

Meng

Hi Meng,

It’s like you read my mind. Your 2nd update added exactly the screenshot I was about to ask for after reading your first. :smile:

I suspect I might know what’s going on here. How about a screenshot of your Quality Gate conditions?

I ask because there is a difference between a condition on the metric “Coverage on New Code” and one on the metric “Coverage” with the “on new code” (IIRC) checkbox checked.

BTW, your OP said you’re on 7.5. The current version and new LTS is 7.9.1. The changes between the two versions include simplifying Quality Gate configuration to eliminate the “on new code” checkbox and migrate any existing conditions. Even without this problem you should consider upgrading at your earliest convenience. :slight_smile:

 
Ann

1 Like

Hi Ann,

I unchecked the ‘on new code’ in both ‘coverage’ and ‘condition coverage’ and only use ‘Coverage on New Code’ to track the new code quality. Looks like fix the issue!

Really appreciate your help!
Meng

2 Likes

Greetings !!!

I was facing the same Sonar Qube 0% code coverage problem for version 7.4 for a couple of days and visited this link.
Thanks to @nemo & @ganncamp - Your inputs really helped and resolve the issue (where I need to uncheck “on new code” for the metrics)

image

Thank you :slight_smile: :slightly_smiling_face:

1 Like

can someone share the steps to disable this? I am running into similar issue which is creating false positive.

Hi @Sri22,

Welcome to the community!

This post had lain dormant for more than 2 years before you resurrected it. Please don’t do that. Please create a new thread with all the details of what you’re experiencing.

 
:smiley:
Ann