Is there a good way to get code coverage for Kotlin with something like JaCoCo? If I just add the source and build dirs, wouldn't it just report false positives due to code generation for e.g. data classes?
g
gildor
10/17/2018, 5:54 AM
There are some Kotlin specific improvements in latest Jacoco versions, that cover data classes and some other cases
so yeah. probably there is some issue of SonarQube
d
Davio
10/17/2018, 10:33 AM
Yeah, it pointed to a stray java file (package-info.java) I had, so maybe there's only an issue with that
As there is no package-info.kts or something like that and I wanted some javadoc on that level, I just added that file
Maybe it confuses Sonar to have that file
I removed it and the warning is gone, but still no coverage in my sonarqube dashboard
I'm still stumped, it looks like I've set up everything correctly, but the Sonar gradle plugin just doesn't trigger its JaCoCo report collector even though I applied the jacoco plugin and a test.exec is generated. Maybe it has to do with using the Kotlin DSL for Gradle. I've looked at sonar logging and all paths point correctly, tried adding system properties such as sonar.java.coverage=jacoco, we have the Kotlin plugin on our sonarqube server, but no luck.