Question about Lines To Cover and Coverage Percentage

Hello, I have a question about sonar coverage, whether it could be a rule error or something in the version.

Test coverage is as follows:


In “Lines to Cover” several files are listed that make up this amount of 2988 lines.

When inspecting the files, several files, despite having 100% coverage, show quantities of lines to be covered, for example:


The question is, are these lines being considered and bringing the percentage down?

Per Sonar documentation,

Lines to cover (lines_to_cover): The number of lines of code that could be covered by unit tests (for example, blank lines or full comments lines are not considered as lines to cover).

And according to the coverage formula,

Coverage = (CT + CF + LC)/(2*B + EL)

Are these blank lines and keys impacting the coverage percentage?

Thank you in advance for your help and attention.

  • Community Edition
  • Version 9.9 (build 65466)


Welcome to the community!

“Lines to Cover” can be better read as “Cover-able lines”

So it’s not about what’s left to do - that’s “Uncovered Liines”, it’s about what’s possible.