Slackbot
09/05/2023, 3:38 PMVampire
09/05/2023, 3:59 PMCtrl+Click on exclude, you see that you configure the test task.
And if you Ctrl+Click on jacoco or look at the type-hint in IntelliJ, you see that you configure the JaCoCo plugin extension, not the JaCoCo task extension. (assuming you use Kotlin DSL, not Groovy DSL where it indeed would be the task extension)
What you are after is
tasks.test {
configure<JacocoTaskExtension> {
excludes = listOf("com.xenoterracide.ai.wh40k.app.Application#main")
}
}Vampire
09/05/2023, 4:01 PMVampire
09/05/2023, 4:01 PMCaleb Cushing
09/05/2023, 4:08 PMtasks.test {
configure<JacocoTaskExtension> {
exclude("com.xenoterracide.ai.wh40k.app.Application#main(*)")
}
}
I still get
> Rule violated for bundle app: instructions covered ratio is 0.3, but expected minimum is 0.9Caleb Cushing
09/05/2023, 4:08 PMaddAll actually be different? usually that's the wrong thing...Caleb Cushing
09/05/2023, 4:10 PMexclude only seems to except file patternsVampire
09/05/2023, 4:12 PMVampire
09/05/2023, 4:13 PMexclude methodCaleb Cushing
09/05/2023, 4:15 PMCaleb Cushing
09/05/2023, 4:15 PMCaleb Cushing
09/05/2023, 4:15 PMVampire
09/05/2023, 4:18 PMCaleb Cushing
09/05/2023, 4:19 PMVampire
09/05/2023, 4:19 PMexcludes property, and also https://docs.gradle.org/current/dsl/org.gradle.testing.jacoco.plugins.JacocoTaskExtension.html just shows the excludes property, no exclude method. 🙂Vampire
09/05/2023, 4:19 PMCaleb Cushing
09/05/2023, 4:19 PMtasks.test {
configure<JacocoTaskExtension> {
excludes = listOf("com.xenoterracide.ai.wh40k.app.Application")
}
}
same way, not enough coverageCaleb Cushing
09/05/2023, 4:19 PMVampire
09/05/2023, 4:21 PMVampire
09/05/2023, 4:21 PMsame way, not enough coverageCheck in the
--info or if not shown --debug logs whether the value is now properly given to the JaCoCo agent.Caleb Cushing
09/05/2023, 4:22 PMCaleb Cushing
09/05/2023, 4:22 PMVampire
09/05/2023, 4:22 PMCaleb Cushing
09/05/2023, 4:23 PMVampire
09/05/2023, 4:23 PMCaleb Cushing
09/05/2023, 4:24 PMCaleb Cushing
09/05/2023, 4:24 PMCaleb Cushing
09/05/2023, 4:25 PMVampire
09/05/2023, 4:25 PMVampire
09/05/2023, 4:26 PMCaleb Cushing
09/05/2023, 4:28 PMtasks.test {
configure<JacocoTaskExtension> {
excludes = listOf("com.xenoterracide.ai.wh40k.app.Application")
}
}
that's when it goes to
> Rule violated for bundle app: instructions covered ratio is 0.0, but expected minimum is 0.9
which is the whole classCaleb Cushing
09/05/2023, 4:28 PM#main ) it stays at 0.3Vampire
09/05/2023, 4:29 PMCaleb Cushing
09/05/2023, 4:29 PMVampire
09/05/2023, 4:30 PMGenerated annotation.
Even though it is discouraged by JaCoCo to use it for manual exclusion of not-generated code, you could apply any annotation with simple name Generated to the method as long as it has at least CLASS retention, then it will be automatically excluded from the reportVampire
09/05/2023, 4:30 PMhow do you skip the recording? I'm confusedExactly like you did it
Caleb Cushing
09/05/2023, 4:30 PMCaleb Cushing
09/05/2023, 4:31 PMVampire
09/05/2023, 4:31 PMCaleb Cushing
09/05/2023, 4:33 PMCaleb Cushing
09/05/2023, 4:33 PMCaleb Cushing
09/05/2023, 4:35 PMCaleb Cushing
09/05/2023, 4:40 PMCaleb Cushing
09/05/2023, 4:49 PMVampire
09/05/2023, 5:44 PMhah, won't let me thumb it up either
Why?
hmm... is there another, better coverage library these days?
None I'm aware of
Caleb Cushing
09/05/2023, 5:45 PMCaleb Cushing
09/05/2023, 5:45 PM