danielpalme / ReportGenerator

ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.
https://reportgenerator.io
Apache License 2.0
2.56k stars 279 forks source link

The generated (GeneratedRegex) codes are count as uncovered branches in v5.2.0 #636

Closed hamidmayeli closed 8 months ago

hamidmayeli commented 9 months ago

Describe the bug I have updated from 5.1.13 to 5.2.0 and now I have 16 uncovered branches as the result of the following code.

[GeneratedRegex("\\{([A-Z]+?)\\}")]
private static partial Regex ParameterRegex();

image

danielpalme commented 9 months ago

@hamidmayeli Your issue is probably not related to the new release. I did not make any changes in that area. To verify that, it would be great if you could share your coverage file. You can send it privately via email: reportgenerator@palmmedia.de

hamidmayeli commented 9 months ago

@danielpalme Thanks for your reply. I have sent you the files. Also, I notice the issue exists in v5.1.26.

hamidmayeli commented 9 months ago

I haven't looked in details but could it be this commit 58257719ffa2dc1cbe71037ea690ecfad52809f0?

danielpalme commented 9 months ago

The class System.Text.RegularExpressions.Generated is included in the report starting with release 5.1.18.

The is related to https://github.com/danielpalme/ReportGenerator/commit/3364c9602c315f9aaba9e238d61021ceaed6144e which fixed #590 and #591.

Before the whole class was not present in the report. Now as it is present, you have some uncovered branches. But I don't think that this is related to the regex.

The regex should exist in line 23.

The branches in that file however are in the following lines:

In total that's 22 of 34 branches covered.

If you want to exclude that file from the report, you can use a filter: E.g. -classfilters:-System.Text.RegularExpressions.Generated