Skip to content

Commit

Permalink
Fixing Linter concerns
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Farley <[email protected]>
  • Loading branch information
adamfarley committed Nov 4, 2024
1 parent 87c5078 commit 5b7a51a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tools/nightly_build_and_test_stats.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
/* groovylint-disable NestedBlockDepth */

import groovy.json.JsonSlurper
import java.math.MathContext;
import java.time.LocalDateTime
import java.time.Instant
import java.time.ZoneId
Expand Down Expand Up @@ -425,19 +426,21 @@ def getReproducibilityPercentage(String jdkVersion, String trssId, String trssUR
}

// Now we have the percentages for each platform, we calculate the jdkVersion-specific average.
Double overallAverage = 0.0
BigDecimal overallAverage = 0.0
// Ignoring the platforms where the test is not available yet.
def naCount = 0
results[jdkVersion][1].each{key, value ->
if (value.equals("NA")) {
naCount++
} else if ( value ==~ /^[0-9]+\.?[0-9]* %/ ) {
overallAverage += (value =~ /^[0-9]+\.?[0-9]*/)[0] as Double
overallAverage += (value =~ /^[0-9]+\.?[0-9]*/)[0] as BigDecimal
}
// else do nothing, as we presume non-integer and non-NA values are 0.
}
overallAverage = overallAverage == 0 ? 0 : overallAverage / (results[jdkVersion][1].size() - naCount)
overallAverage = 0 ? 0 : Math.round(overallAverage * 100) / 100
if (overallAverage != 0) {
overallAverage = overallAverage / (results[jdkVersion][1].size() - naCount)
}
overallAverage.round(new MathContext(3))
results[jdkVersion][0] = overallAverage+" %"
}
}
Expand Down

0 comments on commit 5b7a51a

Please sign in to comment.