Move script to a separate repo

This commit is contained in:
a.romanov 2021-01-28 00:18:51 +03:00 committed by Alexander Romanov
parent 44c720655b
commit b45c288e13
2 changed files with 1 additions and 37 deletions

View File

@ -312,7 +312,7 @@
<goal>execute</goal>
</goals>
<configuration>
<source>https://raw.githubusercontent.com/rbkmoney/service-parent-pom/master/scripts/TestCoverageAnalysis.groovy</source>
<source>https://raw.githubusercontent.com/rbkmoney/test-coverage-analysis-script/master/TestCoverageAnalysis.groovy</source>
</configuration>
</execution>
</executions>

View File

@ -1,36 +0,0 @@
def ansiCyan = "\u001B[36m"
def ansiBlue = "\u001B[34m"
def ansiYellow = "\u001B[33m"
def ansiReset = "\u001B[0m"
def reportFile = new File("target/site/jacoco/index.html")
println "[" + ansiBlue + "INFO" + ansiReset + "] ------------------------------------------------------------------------"
println "[" + ansiBlue + "INFO" + ansiReset + "] " + ansiCyan + "TEST COVERAGE ANALYSIS" + ansiReset
println "[" + ansiBlue + "INFO" + ansiReset + "] ------------------------------------------------------------------------"
if (!reportFile.exists() || !reportFile.canRead()) {
println "[" + ansiYellow + "WARN" + ansiReset + "] Unable to find jacoco report file in ./target/site/jacoco/index.html"
return
}
reportFile.withReader('UTF-8') { reader ->
def html = parser().parseText(reader.readLine())
def totalRow = html.body.table.tfoot.tr
def instructionsMissed = totalRow.td[1]
def instructionsCoverage = totalRow.td[2]
def branchesMissed = totalRow.td[3]
def branchesCoverage = totalRow.td[4]
println "[" + ansiBlue + "INFO" + ansiReset + "] Instructions ${instructionsCoverage} (Missed ${instructionsMissed})"
println "[" + ansiBlue + "INFO" + ansiReset + "] Branches ${branchesCoverage} (Missed ${branchesMissed})"
println "[" + ansiBlue + "INFO" + ansiReset + "]"
println "[" + ansiBlue + "INFO" + ansiReset + "] For more information: open ./target/site/jacoco/index.html"
}
XmlSlurper parser() {
parser = new XmlSlurper()
parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
return parser
}