Search in sources :

Example 1 with SingleFileReport

use of org.gradle.api.reporting.SingleFileReport in project gradle by gradle.

the class FindBugs method evaluateResult.

@VisibleForTesting
void evaluateResult(FindBugsResult result) {
    if (result.getException() != null) {
        throw new GradleException("FindBugs encountered an error. Run with --debug to get more information.", result.getException());
    }
    if (result.getErrorCount() > 0) {
        throw new GradleException("FindBugs encountered an error. Run with --debug to get more information.");
    }
    if (result.getBugCount() > 0) {
        String message = "FindBugs rule violations were found.";
        SingleFileReport report = reports.getFirstEnabled();
        if (report != null) {
            String reportUrl = new ConsoleRenderer().asClickableFileUrl(report.getDestination());
            message += " See the report at: " + reportUrl;
        }
        if (getIgnoreFailures()) {
            getLogger().warn(message);
        } else {
            throw new GradleException(message);
        }
    }
}
Also used : GradleException(org.gradle.api.GradleException) ConsoleRenderer(org.gradle.internal.logging.ConsoleRenderer) SingleFileReport(org.gradle.api.reporting.SingleFileReport) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 GradleException (org.gradle.api.GradleException)1 SingleFileReport (org.gradle.api.reporting.SingleFileReport)1 ConsoleRenderer (org.gradle.internal.logging.ConsoleRenderer)1