Compare commits

...

4 Commits

Author SHA1 Message Date
cclecle
bd3389aeb2 cast to double + fix complexity 2023-03-23 22:37:45 +00:00
cclecle
886a22bef2 add missing java lib in groovy 2023-03-23 22:23:57 +00:00
cclecle
e9355471ba cast float to strings 2023-03-23 22:19:48 +00:00
cclecle
3bbbe946a1 switch to readfile 2023-03-23 21:54:21 +00:00

18
Jenkinsfile vendored
View File

@@ -11,6 +11,7 @@ import static javax.xml.xpath.XPathConstants.*
import javax.xml.xpath.*
import groovy.xml.DOMBuilder
import groovy.xml.dom.DOMCategory
import java.math.RoundingMode
// configurable settings:
// use to send email if workflow problem
@@ -73,8 +74,9 @@ String ExtractBaseVersion(inVersion) {
int GetCoverageValue(String CoverageFilePath,String XPath)
{
File file = new File(CoverageFilePath)
coverageReportRaw = file.getText('UTF-8')
//File file = new File(CoverageFilePath)
//coverageReportRaw = file.getText('UTF-8')
coverageReportRaw = readFile(CoverageFilePath)
coverageReport = DOMBuilder.parse(new StringReader(coverageReportRaw), false, false)
coverageReportRoot = coverageReport.documentElement
@@ -89,7 +91,7 @@ int GetCoverageValue_line_rate(String CoverageFilePath) { return GetCoverageValu
int GetCoverageValue_branches_valid(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@branches-valid") }
int GetCoverageValue_branches_covered(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@branches-covered") }
int GetCoverageValue_branch_rate(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@branch-rate") }
int GetCoverageValue_branches_complexity(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@branches-complexity") }
int GetCoverageValue_complexity(String CoverageFilePath) { return GetCoverageValue(CoverageFilePath,"/coverage/@complexity") }
pipeline {
@@ -439,11 +441,13 @@ pipeline {
println GetCoverageValue_branch_rate(coverage_report_path)
println GetCoverageValue_branches_complexity(coverage_report_path)
full_rate = (GetCoverageValue_line_rate(coverage_report_path) + GetCoverageValue_branch_rate(coverage_report_path)) / 2
badge_coverage.setStatus(full_rate)
full_rate = 1.0 * (GetCoverageValue_line_rate(coverage_report_path) + GetCoverageValue_branch_rate(coverage_report_path)) / 2
sz_full_rate =Float.toString(full_rate.setScale(2, RoundingMode.HALF_EVEN))
badge_coverage.setStatus(sz_full_rate)
complexity = GetCoverageValue_branches_complexity(coverage_report_path)
badge_complexity.setStatus(complexity)
complexity = 1.0 * GetCoverageValue_complexity(coverage_report_path)
sz_complexity =Float.toString(complexity.setScale(2, RoundingMode.HALF_EVEN))
badge_complexity.setStatus(sz_complexity)
}
}
}