Closed jmartinesp closed 6 months ago
You have to create a new report variant and apply filters and rules in it. See here: https://github.com/Kotlin/kotlinx-kover/blob/v0.8.0/docs/gradle-plugin/migrations/migration-to-0.8.0.md#the-format-specific-reports-filters-has-been-removed
So configuration will look like this:
kover {
currentProject {
createVariant("myScope") {
add("jvm")
}
}
reports {
variant("myScope") {
filters {
// your filters
}
verify {
// your rules
}
}
}
}
Thanks, then I was on the right track, then I guess it doesn't make sense to have several rules for a variant.
I think I understand the 'right' way to use it now, but then I have another question. At the moment we're only testing our gplayDebug
Android variant which in turn uses all the rules.
With the new changes, does this mean we'll have to use:
./gradlew :app:verifyGplayDebug // Current one
./gradlew :app:verifyPresenters // From a rule
./gradlew :app:verifyViews // From another rule
// etc.
Separately, for each variant created from a rule? Or is there some way to test only the gplayDebug
Android variant and all the other newly defined ones? Some way to create a parent one that also runs the child ones?
You can declare a Gradle task that depends on all the verify*
tasks that you want to run, that should do the trick.
I was so focused in finding a solution for this in Kover that I forgot I could actually handle this in Gradle 😅 .
I think that answers all my questions, thanks again!
Describe what you would like to clarify about Kover
In our project we have sets of rules which apply to certain types of classes, like:
We have other for Compose views and similar certain classes where we want to be more or less strict about coverage than in the total coverage verification.
However, on
v0.8.0
overriding filters for rules is deprecated, so I'm not sure if it's possible to have these checks anymore. If it is, what's the new way to define these? And if it's not, then what's the point of having named rules if you can't apply them to different sources?