Does anyone know if there's a solution to kotlin +...
# announcements
k
Does anyone know if there's a solution to kotlin + JaCoCo? I cannot meet my quality gates in sonar because coverage is too low. There are a couple of functions that should be covered though
c
I’m using jacoco 0.8.2 and that works fine with kotlin
k
I end up with
Copy code
Cannot import coverage information for file …, coverage data is invalid. Error: {}
java.lang.IllegalStateException: Line 13 is out of range in the file … (lines: 12)
Current gradle + jacoco plugin (I think it's version 0.8.2 as well)
Maybe it's a problem of the sonarqube import?
c
thats probably it, because normal jacoco works for me
m
@christophsturm Even with Jacoco 0.8.2 I still have issues with Kotlin. It ask me to test my data classes, exceptions or
GlobalScope.launch{
lines. Do you have any solutions for that ?
m
I exclude them from coverage and sonar, but that may not be an option for you. There are some Kotlin conventions that Jacoco just doesn’t determine coverage correctly for. inline functions are a great example of that.
m
How do you exclude them ? Sonar allows only to exclude files using file name pattern, but I can’t exclude all my data class 1 by 1. Isn’t there any other solution?
m
Sonar supports wildcard exclusions too so assuming they're all in one package...
189 Views