-
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
kover should able to exclude interface default method #623
Comments
We will consider adding similar filters in the future. But could you describe your case in more detail, for what purpose do you have methods with default implementation in interfaces, but it is acceptable for you not to use them? |
I discovered the issue after introducing Koin(https://github.com/InsertKoinIO/koin) as the dependency injection framework in my project. and found the interface KoinComponent has a default implementation. |
Do I understand correctly that the The collection of coverage is primarily aimed at finding unused code that the project developer wrote. |
yes. you are right. but i have my own code which extends external code like |
could you provide an XML report, at least part with class The report you provided is generated using codecov, we do not control it directly, it may have its own rules for calculating coverage |
Here you go build.gradle.kts kover {
reports {
filters {
excludes {
classes(
"com.tddworks.**.*\$*$*", // Lambda functions like - LemonSqueezyLicenseApi$activeLicense$activationResult$1
"com.tddworks.**.*\$Companion", // Lambda functions like - LemonSqueezyLicenseApi$activeLicense$activationResult$1
"*.*\$\$serializer", // Kotlinx serializer)
)
// inheritedFrom("org.koin.core.component.KoinComponent")
// annotatedBy("kotlinx.serialization.Serializable")
}
includes {
classes("com.tddworks.*")
}
}
verify {
rule {
bound {
minValue = 82
}
}
}
}
} report xml <package name="com/tddworks/anthropic/api">
<class name="com/tddworks/anthropic/api/AnthropicConfig" sourcefilename="AnthropicConfig.kt">
<method name="getKoin" desc="()Lorg/koin/core/Koin;">
<counter type="INSTRUCTION" missed="2" covered="0"/>
<counter type="BRANCH" missed="0" covered="0"/>
<counter type="LINE" missed="1" covered="0"/>
</method>
<method name="<init>" desc="(Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)V">
<counter type="INSTRUCTION" missed="0" covered="24"/>
<counter type="BRANCH" missed="0" covered="0"/>
<counter type="LINE" missed="0" covered="3"/>
</method>
<counter type="INSTRUCTION" missed="2" covered="24"/>
<counter type="BRANCH" missed="0" covered="0"/>
<counter type="LINE" missed="1" covered="3"/>
<counter type="METHOD" missed="1" covered="1"/>
</class> and you can also found from - app.codecov.io Thanks. |
It's bug in Kover reporter. Reproducer
report
Kotlin |
thx. |
It's nice to have a filter for excluding the interface which has a default implementation
E.g
Check here
the cover is not covered unless added a ut like below
The text was updated successfully, but these errors were encountered: