Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XML] Codecov.io does not see files with package mismatch #260

Open
IgnatBeresnev opened this issue Oct 20, 2022 · 2 comments
Open

[XML] Codecov.io does not see files with package mismatch #260

IgnatBeresnev opened this issue Oct 20, 2022 · 2 comments
Labels

Comments

@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented Oct 20, 2022

If you have a Kotlin file with some classes/functions under a certain package, for example

src/main/kotlin/org/jetbrains/kover/reproducer/PackageMismatchFile.kt

but inside the file you have a different package declared, for example

package org.jetbrains.kover.reproducer.some.inner.pckg // some.inner.pckg has been added

class PackageMismatchClass {}

codecov.io will not see (and thus not calculate coverage for) this file. You can observe it in this report.

If you physically move the file to the "correct" package, it will work as expected.

The problem might be relevant for other tools that use Jacoco format since this behaviour is not possible in Java (package must match location), and tools that analyze Jacoco coverage reports might rely on that.


I haven't noticed any difference in generated XML reports between Jacoco and IntelliJ engines, both generate the following paths:

    <package name="org/jetbrains/kover/reproducer/some/inner/pckg">
        <class name="org/jetbrains/kover/reproducer/some/inner/pckg/PackageMismatchClass"
               sourcefilename="PackageMismatchFile.kt">
            ...
        </class>
        <sourcefile name="PackageMismatchFile.kt">
            ...
        </sourcefile>
        ...
    </package>

Runnable reproducer can be found in this repo, there are instructions on how to run it and upload the report.

This was found while investigating #16

@shanshin shanshin added the S: untriaged Status: issue reported but unprocessed label Oct 20, 2022
@twyatt
Copy link

twyatt commented Mar 2, 2023

For more context, related JaCoCo issue: jacoco/jacoco#939

@shanshin shanshin added S: postponed Status: work on the issue is not in the short term plans and removed S: untriaged Status: issue reported but unprocessed labels Apr 21, 2023
@shanshin shanshin added Implement in KGP and removed Kover Coverage Tool S: postponed Status: work on the issue is not in the short term plans labels Jan 3, 2025
@shanshin
Copy link
Collaborator

shanshin commented Jan 3, 2025

This task will be taken into account when migrating to Kotlin Gradle Plugin.

In the future, it will be moved to the Kotlin task tracker, or closed if it loses relevance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants