Skip to content

Commit 75c531d

Browse files
author
ubourdon_kyriba
committed
improve: OverallCheckTask
1 parent 95675e2 commit 75c531d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/groovy/com/github/maiflai/OverallCheckTask.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.gradle.api.tasks.TaskAction
99
*/
1010
class OverallCheckTask extends DefaultTask {
1111
File cobertura
12-
double minimumLineRate = 1
12+
double minimumLineRate = 0.75
1313

1414
@TaskAction
1515
void requireLineCoverage() {
@@ -21,6 +21,7 @@ class OverallCheckTask extends DefaultTask {
2121
def overallLineRate = xml.attribute('line-rate').toDouble()
2222
def difference = (minimumLineRate - overallLineRate)
2323

24-
if (difference > 0.001) throw new GradleException("Line coverage of $overallLineRate is below $minimumLineRate by $difference")
24+
if (difference > 1e-7)
25+
throw new GradleException("Only ${overallLineRate * 100}% of project is covered by tests instead of ${(minimumLineRate * 100).toInteger()}%!")
2526
}
2627
}

0 commit comments

Comments
 (0)