Closed stealthrabbi closed 4 years ago
Hi, you can do this by 2 possible ways
OK thanks. And sorry if "issues" are not the right way to ask this, but I saw no other way.
So I (temporarily) want to cause builds to fail if there are any warnings or errors in PMD, spotbugs, or checkstyles. And I want it to fail if there are any Errors in Android Lint (warnings are OK).
So perhas a custom validator like so? I assume that if I fail to configure the evaluator correctly, the gradle task itself will fail to run.
evaluator { Set allViolations ->
allViolations.each { violation ->
// an error from any analyzer should fail the build
if (violation.errors > 0) {
throw new GradleException("Static Analysis errors reported")
} else if (violation.name != "Lint" && violations.warnings > 0) {
// do not allow warnings, unless it's android lint
throw new GradleException("non-Lint Static Analysis warnings have reported")
}
}
}
No problem at all. Let us know if this works. It looks correct to me. The name for Android Lint is just Lint
.
The violation class has paths to XML and HTML report files. The original evaluator outputs those for the failed tasks. You might want to keep that.
e.g. allow warnings in Android Linter, but not SpotBugs