Kotlin / kotlinx-kover

Apache License 2.0
1.37k stars 53 forks source link

Differences in coverage between XML/HTML and verify #692

Open glureau opened 1 month ago

glureau commented 1 month ago

Describe the bug The coverage value is different between XML/HTML and what verify is checking. I don't have a reproducer but on my project I'm getting :

<report name="Kover Gradle Plugin XML report for ...">
   [...]
    <counter type="INSTRUCTION" missed="4473" covered="8809"/>
    <counter type="BRANCH" missed="171" covered="195"/>
    <counter type="LINE" missed="661" covered="1426"/>
    <counter type="METHOD" missed="288" covered="363"/>
    <counter type="CLASS" missed="152" covered="246"/>
</report>

I compute the branch coverage with 195/(171+195) = 0,5327868852, that we can round to 53.3%

In my HTML report I get the same values (171+195 = 366)

Screenshot 2024-10-11 at 12 10 17

And when I ran koverVerify:

Rule 'global' violated: branches covered percentage is 53.005500, but expected minimum is 80

Not the best example, on some other modules, the difference is way greater than 1%.

Expected behavior I want the same value in XML and in koverVerify

Reproducer I can't share my code at the moment. You may be able to reproduce by simply checking values in LegacyVerification. Here another screenshot while debugging (another module).

image

Environment

shanshin commented 1 month ago

Hi, could you clarify which filters are used during the report generation?

Are annotatedBy filters used?