New lines to cover incorrect

The new lines to cover is incorrect:

For example: I am told that there are 72 lines to cover. I click.

The top file has 11 lines to cover. I click.

This is what I see:

On new code
Coverage 100%
Lines to Cover 11
Uncovered Lines 0
Line Coverage 100%
Conditions to Cover 0
Uncovered Conditions 0
Overall
Coverage 100%
Lines to Cover 32
Uncovered Lines 0
Line Coverage 100%

Why am I being told my code is uncovered when it (and your tool) tells me it is?

Hi,

I am having some trouble understanding the exact context of your problem.

Could you include some screen shots and walk us through what you see as the problem?

I am not allowed to post a screen shot of the issue (I am a contractor) though I will describe exactly what I see. If you need more then ask.

I am on the Quality Gate screen with the metrics. It says there are 72.22% coverage on new code in the last 30 days and underneath it states there are 72 lines to cover.

I click that. This gives me a screen with a list headed “Lines to Cover on New Code 72”. A quick totting up does indeed come to 72.
The top line is “src/path/to/Config.cpp” which has 11 lines of code uncovered. So I click that.

I now see that file. Every line is covered in green in the gutter. The new lines (highlighted in yellow) have green in the gutter. There is 100% coverage.

That means the metric of 72.22% is wrong.

Maybe I am reading it wrong?

You are making a big deal out of the “72 Lines to Cover” when you should be pushing the 20 lines of uncovered code.

So I take back the assertion that the metric is wrong, but the wording is poor.

The complete wording is "
72.22%
Coverage on
72 New Lines to Cover" which seems to suggest that there are 72 lines which are uncovered due to the line breaks. The fact that the 72 is clickable and shows you a list with the heading “Lines to Cover on New Code” suggests that there are 72 lines uncovered.

A better wording is needed.

It should be “72.22%
Coverage
20 Uncovered New Lines” and then that link will take you to the important metric - the uncovered lines.

Thanks for clarifying. I do agree that the wording is confusing. I’ll check with my colleagues and point out this issue. If we decide open a ticket about this I will post the link to the ticket here.

Thanks again for taking the time to point this out.

Hi Graham,

I have opened and issue about this here: https://jira.sonarsource.com/browse/SCCOMM-38

The team will take a look and if it is agrred that the description needs improvement, it will be fixed.

Thanks for pointing it out.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.