DEV Community

loading...

Discussion on: Grails and Sonarqube

Collapse
ukbarr profile image
ukbarr

hi thx for the article, it was very helpful.

what's in your cloverXtraConfig.groovy & AbortIfNotCoverage.groovy files .

Cheers !

Collapse
jagedn profile image
Jorge Eψ=Ĥψ Author

true, I forgotten them

I use cloverXtraConfig.groovy to remove CompileStatic and TypeChecked annotations:

withConfig(configuration) {
    inline(phase: 'CONVERSION') { source, context, classNode ->
        source.ast.unit.classes.each { clazz ->
            clazz.annotations.removeAll { annotation -> annotation.classNode.name in ['CompileStatic', 'TypeChecked'] }
        }
    }
}

and in AbortIfNoCoverage.groovy I parse the final xml to calculate the average cobertura and if it's under a limit throw a exception to abort the pipeline

Forem Open with the Forem app