Skip to content

Instantly share code, notes, and snippets.

@kheremos
Created October 3, 2014 17:48
Show Gist options
  • Save kheremos/4d4cec493427476db09d to your computer and use it in GitHub Desktop.
Save kheremos/4d4cec493427476db09d to your computer and use it in GitHub Desktop.
Gradle task to parse a Jacoco report and list the classes where INSTRUCTION_COVERED = 0.
task printNakedClasses (dependsOn: test)<< {
ext.TEST_FILE_NAME = "$buildDir/reports/jacoco/test/jacocoTestReport.csv"
//load and split the file
ext.inputFile = file(ext.TEST_FILE_NAME)
String[] lines = inputFile.text.split('\n')
List<String[]> rows = lines.collect {it.split(',')}
def classesUncovered = rows.findAll { row ->
row[4]=="0"
}
println "uncovered classes:"
classesUncovered.each { elem ->
println "\t${elem[1]}\t${elem[2]}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment