Lines to cover drop

Hi all
We have a project which has experienced in a sudden both an unexpected drop in “Lines to cover” and “Covered lines”

Any idea of what could have happened here?
No change in configuration or exclusion has been applied. It happened after an automated build during the weekend and now the “Lines to cover” remains in the same level and we cannot return it to the previous one.
How is Sonar measuring “Lines to cover”?
Thanks in advance!

To add some more clarity: our total number of lines did not go down

Hey there.

Can you make sure you’ve included all the information from the template post, such as SonarQube version?

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Hi Colin thanks for your answer!
Sorry I didn’t include this in the initial answer, I hope this is enough:

  • SonarQube: 8.9.7.52159

  • Scanner: 4.3.0.2102-linux

  • npm (I understand this is the plugin): 6.14.15

Project is frontend (angular, html, css)

Thanks!

Lines to Cover is information that SonarQube gleans directly from the coverage reports it has been provided (which indicates which lines have and haven’t been covered). If no information is included in the coverage reports (for example, an entire file is absent), it takes a well-informed “guess”.

So most likely something has changed in the coverage reports being provided, and you might want to check to see if anything has changed between pipeline runs in the step where you run tests / generate code coverage.

It’s also worth checking that a coverage exclusion hasn’t slipped in there without you knowing, which would also impact these measures.

Hi again and thanks for quick answer!
Problem here is that we have not modified or done any new exclusion.
We have re-run branches from 1-2-5 months ago and new “lines to cover” number persists with the new one, we are not capable to return to previous number.
The main issue for us in here is that the “lines to cover” that have disappeared were mostly covered, so biggest issue here is that our general coverage has gone down.

Hi again
Still seeking for some help
After some time, lines returned to previous values and as we have executions now before and after we have been able to compare
We have found that the headers of the methods are not being counted in one of them

Any idea on why this can be happening?

SonarQube reads all of this data from the coverage reports it’s being provided. I would really encourage you to:

check to see if anything has changed between pipeline runs in the step where you run tests / generate code coverage.

This could include directly comparing the coverage reports for a given file where you see fluctuations (is the file reported in both the before/after coverage reports? with the same coverage?)