use of org.jacoco.report.check.Rule in project jacoco by jacoco.
the class CheckMojo method executeCheck.
private void executeCheck() throws MojoExecutionException {
violations = false;
final ReportSupport support = new ReportSupport(getLog());
final List<Rule> checkerrules = new ArrayList<Rule>();
for (final RuleConfiguration r : rules) {
checkerrules.add(r.rule);
}
support.addRulesChecker(checkerrules, this);
try {
final IReportVisitor visitor = support.initRootVisitor();
support.loadExecutionData(dataFile);
support.processProject(visitor, getProject(), this.getIncludes(), this.getExcludes());
visitor.visitEnd();
} catch (final IOException e) {
throw new MojoExecutionException("Error while checking code coverage: " + e.getMessage(), e);
}
if (violations) {
if (this.haltOnFailure) {
throw new MojoExecutionException(CHECK_FAILED);
} else {
this.getLog().warn(CHECK_FAILED);
}
} else {
this.getLog().info(CHECK_SUCCESS);
}
}
Aggregations