-
Notifications
You must be signed in to change notification settings - Fork 53
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] Inaccurate coverage for files with same name, but from different source sets #279
Comments
We will do as in JaCoCo, for summing up the values for different classes. Since the XML format does not assume that there are duplicates of files with the same name, then there is no single correct solution that other tools will work with. |
To add context to the message above, source files will have a path relative to the source set roots, similar to how it's done for classes:
This will solve the problem of duplicated sourcefile lines and allow to differentiate between files from different locations. However, if both files share the same relative path, they will still be indistinguishable |
The 'sum up' behavior is done in agent version |
To use custom engine you need to configure it in all projects where Kover is used for Kotlin Gradle script
for Groovy
|
Relates codecov/uploader#913 |
Any news on this? |
Describe the bug
XML report generates inaccurate coverage for files with same name, but from different source sets.
Take the following project structure as an example:
where
KoverFile.kt
will contain:KoverCommonClass
forcommonMain
source setKoverJvmClass
forjvmMain
source set.Generated XML report will look the following way:
As you can see, both classes lead to the same source file, the description for which duplicates line numbers. Because the code is the same in both classes, the duplicated lines are the same, but I imagine if the code is vastly different, it'll be a mess.
This leads to codecov.io ignoring such files altogether, presumably because it doesn't know how to map it to project's git structure. See codecov report. This, in turn, affects calculated coverage. Umbrella issue: #16
This problem does not exists in HTML reports as it doesn't offer file-based coverage.
(additional files
CommonFile
andJvmFile
are added to demonstrate that codecov sees Kotlin files otherwise)Expected behavior
Not sure what could be done in this situation as it seems to be a limitation of XML report's structure, but maybe some additional kover-specific tags could be added, or some other way to differentiate between source sets.
Reproducer
Project (notice the branch): https://github.com/IgnatBeresnev/kover-reproducers/tree/mpp-same-filename
There are instructions in the README on how the report can be generated and uploaded to codecov.io
Reports
Gist with XML report: https://gist.github.com/IgnatBeresnev/418ab0514b699fea7473cb2d4d275480
Environment
The text was updated successfully, but these errors were encountered: