You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
We have kotlin extension functions inside our codebase which are located just inside a kotlin file, but not inside another class or object. When generating a kover report inside a single gradle feature module the coverage is correct and the function is included.
When using the aggregated project report this single extension function is excluded unless we put it inside of another class or object.
Sample wich results in 0% coverage:
@StringRes
fun Tag.getActivationButtonText(): Int {
returnwhen (this) {
Tag.NOT_AVAILABLE->R.string.badge_not_available
Tag.COMING_SOON->R.string.badge_coming_soon
Tag.LAST_CHANCE,
Tag.UNKNOWN->R.string.activate_voucher
}
}
object TagExt {
@StringRes
fun Tag.getActivationButtonText(): Int {
returnwhen (this) {
Tag.NOT_AVAILABLE->R.string.badge_not_available
Tag.COMING_SOON->R.string.badge_coming_soon
Tag.LAST_CHANCE,
Tag.UNKNOWN->R.string.voucherdetails_activate_voucher
}
}
}
The file is just missing inside the generated XML/Html Reports
Expected behavior
The aggregated report is complete and standalone extension functions are included.
Reproducer
please check problem description above
Reports
Unfortunately I cant provide you with full reports as it is a private repository but will try to answer you all upcoming question to resolve this issue.
Environment
Kover Gradle Plugin version: 0.7.5 (also tested with 0.8.3)
Gradle version: 8.6
Kotlin project type: Kotlin/Android
The text was updated successfully, but these errors were encountered:
sorry the line was indeed a bit misleading. The function is included in module reports generated by ./gradlew features:featureA:koverXmlReportDebug with correct coverage
but in aggregated reports via ./gradlew koverXmlReportBuildVariant the function is completely missing.
Unfortunately, without a producer, it's hard to say what the problem might be, in the configuration or in a bug.
However, keep in mind that when you move an extension function from a class to the file level, it will be located in another class.
E.g. if the fun SomeClass.action() function is located in the foo/bar/Biz file, then this function will be in the foo.bar.BizKt class in the report (foo.bar.BizKt.action function)
Hi shanshin,
thank you for pointing me into the right direction! While preparing a sample project to reproduce this issue I stumbled upon a silly configuration on our side. This configuration together with a not so ideal naming convention resulted in this behaviour.
First we generally put public extension functions in files suffixed with .ext.kt -> this resulted in Names in the kover report like Tag_ext.kt
Secondly we tried to exclude all generated code from our coverage reports by excluding all files with *_* in their name.
Because the kover configuration only is used for the merged report the module report included the file while the aggregated didn't. So we will probably change our naming-convention for extension functions and overhaul our kover config aswell ;)
Sorry for bothering you, many thanks for your assistance on this issue and for developing this great tool.
Dear kover team (:
Describe the bug
We have kotlin extension functions inside our codebase which are located just inside a kotlin file, but not inside another class or object. When generating a kover report inside a single gradle feature module the coverage is correct and the function is included.
When using the aggregated project report this single extension function is excluded unless we put it inside of another class or object.
Sample wich results in 0% coverage:
Workaround 1:
Workaround 2:
The file is just missing inside the generated XML/Html Reports
Expected behavior
The aggregated report is complete and standalone extension functions are included.
Reproducer
please check problem description above
Reports
Unfortunately I cant provide you with full reports as it is a private repository but will try to answer you all upcoming question to resolve this issue.
Environment
The text was updated successfully, but these errors were encountered: