Kotlin / kotlinx-kover

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Excluded annotated methods cause invalid coverage on Sonar

phcannesson opened this issue · comments

I use Kover on an Android app that uses Compose for its UI.

As we don't really want (for now) to have coverage on Compose code, we've excluded the @Composable annotation.

But this causes files that contains only compose functions to be completely ignored, and therefore to be missing from reports (that apparently organize coverage per class).
Sonar unfortunately interprets this absence as "Uncovered".

On the other hand, if in the same file, we have a data class :

data class UIData(
    val someData: T
)

@Composable
fun MyComposable() {
    Text("some text")
}

then a report is created for this file/class and Sonar will understand and the MyComposable is ignored.

Is there some kind of support for this use case ? Maybe tell Kover to aggregate reports by file instead of class?
Or is it something to fix on our Sonar configuration ?

Hi,
do you use XML report to integrate with Sonar?
It might be worth trying to set up Sonar, the XML format of the report is fixed and cannot be changed on our part.