coverlet-coverage / coverlet

Cross platform code coverage for .NET
MIT License
2.94k stars 385 forks source link

coverlet report no coverage on blank lines #1504

Open tannertaylor opened 11 months ago

tannertaylor commented 11 months ago

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'

daveMueller commented 8 months ago

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 🙂.

github-actions[bot] commented 4 months ago

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