coverlet icon indicating copy to clipboard operation
coverlet copied to clipboard

coverlet report no coverage on blank lines

Open tannertaylor opened this issue 2 years ago • 2 comments

coverlet seems to be reporting blank lines as not covered. I've obscured this image to protect company source code, but if you refer to the gutters on the left, you can see a few red markers indicating missing coverage on blank lines.

image

At first, I thought this may just be the Coverage Gutters VS Code extension, but I see the same thing when looking at the cobertura.xml, which reports an 85% line rate, consistent with what you see in the gutters:

image

I wouldn't expect blank lines to throw off my coverage numbers. Am I missing some configuration setting?

For the record, I'm using coverlet.msbuild and running this command:

dotnet test /p:CollectCoverage=true /p:CoverletOutput='../../coverage/' /p:CoverletOutputFormat="cobertura%2cjson" /p:MergeWith='../../coverage/coverage.json' /p:ExcludeByAttribute='ExcludeFromCodeCoverage' -m:1'

tannertaylor avatar Jul 28 '23 03:07 tannertaylor

At first sight I don't see anything you are missing. In general empty lines aren't instrumented and thus also shouldn't be part of the report. Here is an example for that:

grafik

It would be very helpful for us if we would have a simple repro for that 🙂.

daveMueller avatar Nov 08 '23 23:11 daveMueller

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] avatar Feb 11 '24 01:02 github-actions[bot]