private void configureReportsConventionMapping(JDepend task, final String baseName) { task.getReports().all(new Action<SingleFileReport>() { @Override public void execute(final SingleFileReport report) { ConventionMapping reportMapping = conventionMappingOf(report); reportMapping.map("enabled", new Callable<Boolean>() { @Override public Boolean call() { return report.getName().equals("xml"); } }); reportMapping.map("destination", new Callable<File>() { @Override public File call() { final String fileSuffix = report.getName().equals("text") ? "txt" : report.getName(); return new File(extension.getReportsDir(), baseName + "." + fileSuffix); } }); } }); }
private void configureReportsConventionMapping(FindBugs task, final String baseName) { task.getReports().all(new Action<SingleFileReport>() { @Override public void execute(final SingleFileReport report) { ConventionMapping reportMapping = conventionMappingOf(report); reportMapping.map("enabled", new Callable<Boolean>() { @Override public Boolean call() { return report.getName().equals("xml"); } }); reportMapping.map("destination", new Callable<File>() { @Override public File call() { return new File(extension.getReportsDir(), baseName + "." + report.getName()); } }); } }); }
private void configureReportsConventionMapping(CodeNarc task, final String baseName) { task.getReports().all(new Action<SingleFileReport>() { @Override public void execute(final SingleFileReport report) { ConventionMapping reportMapping = AbstractCodeQualityPlugin.conventionMappingOf(report); reportMapping.map("enabled", new Callable<Boolean>() { @Override public Boolean call() { return report.getName().equals(extension.getReportFormat()); } }); reportMapping.map("destination", new Callable<File>() { @Override public File call() { String fileSuffix = report.getName().equals("text") ? "txt" : report.getName(); return new File(extension.getReportsDir(), baseName + "." + fileSuffix); } }); } }); }
private void configureFindbugsTask( final Project project, final FindBugs findbugsTask, final String circleReportsDir, final StyleTaskTimer timer) { // Ensure XML output is enabled findbugsTask.doFirst(new Action<Task>() { @Override public void execute(Task task) { for (SingleFileReport report : findbugsTask.getReports()) { report.setEnabled(false); } FindBugsXmlReport xmlReport = (FindBugsXmlReport) findbugsTask.getReports().findByName("xml"); xmlReport.setEnabled(true); xmlReport.setWithMessages(true); } }); // Configure the finalizer task CircleStyleFinalizer finalizer = createTask( project.getTasks(), findbugsTask.getName() + "CircleFinalizer", CircleStyleFinalizer.class); if (finalizer == null) { // Already registered (happens if the user applies us to the root project and subprojects) return; } finalizer.setReportParser(FindBugsReportHandler.PARSER); finalizer.setStyleTask(findbugsTask); finalizer.setReporting(findbugsTask); finalizer.setStyleTaskTimer(timer); finalizer.setTargetFile(new File( new File(circleReportsDir, "findbugs"), project.getName() + "-" + findbugsTask.getName() + ".xml")); findbugsTask.finalizedBy(finalizer); }
private Checkstyle createCheckstyleTask(Project project) throws IOException { Checkstyle checkstyle = project.getTasks().create("checkstyleTest", Checkstyle.class); SingleFileReport xmlReport = checkstyle.getReports().getByName("xml"); String originalReportXml = readTestFile("two-namecheck-failures-checkstyle.xml"); String modifiedReportXml = originalReportXml.replace(ROOT.toString(), projectDir.getRoot().getCanonicalPath().toString()); File modifiedReportFile = projectDir.newFile(); Files.write(modifiedReportXml, modifiedReportFile, UTF_8); xmlReport.setDestination(modifiedReportFile); return checkstyle; }
private void configureReportsConventionMapping(Pmd task, final String baseName) { task.getReports().all(new Action<SingleFileReport>() { @Override public void execute(final SingleFileReport report) { ConventionMapping reportMapping = AbstractCodeQualityPlugin.conventionMappingOf(report); reportMapping.map("enabled", Callables.returning(true)); reportMapping.map("destination", new Callable<File>() { @Override public File call() { return new File(extension.getReportsDir(), baseName + "." + report.getName()); } }); } }); }
private void configureReportsConventionMapping(Checkstyle task, final String baseName) { task.getReports().all(new Action<SingleFileReport>() { @Override public void execute(final SingleFileReport report) { ConventionMapping reportMapping = conventionMappingOf(report); reportMapping.map("enabled", Callables.returning(true)); reportMapping.map("destination", new Callable<File>() { @Override public File call() { return new File(extension.getReportsDir(), baseName + "." + report.getName()); } }); } }); }
@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); } } }
public CodeNarcReportsImpl(Task task) { super(SingleFileReport.class, task); add(TaskGeneratedSingleFileReport.class, "xml", task); add(TaskGeneratedSingleFileReport.class, "html", task); add(TaskGeneratedSingleFileReport.class, "text", task); }
public FindBugsReportsImpl(Task task) { super(SingleFileReport.class, task); add(FindBugsXmlReportImpl.class, "xml", task); add(CustomizableHtmlReportImpl.class, "html", task); add(TaskGeneratedSingleFileReport.class, "text", task); add(TaskGeneratedSingleFileReport.class, "emacs", task); }
public FindBugsReportsImpl(Task task) { super(SingleFileReport.class, task); add(FindBugsXmlReportImpl.class, "xml", task); add(TaskGeneratedSingleFileReport.class, "html", task); add(TaskGeneratedSingleFileReport.class, "text", task); add(TaskGeneratedSingleFileReport.class, "emacs", task); }
public Reporting<? extends ReportContainer<SingleFileReport>> getReporting() { return reporting; }
public void setReporting(Reporting<? extends ReportContainer<SingleFileReport>> reporting) { this.reporting = reporting; }
public PmdReportsImpl(Task task) { super(SingleFileReport.class, task); add(TaskGeneratedSingleFileReport.class, "html", task); add(TaskGeneratedSingleFileReport.class, "xml", task); }
public SingleFileReport getHtml() { return getByName("html"); }
public SingleFileReport getXml() { return getByName("xml"); }
public CheckstyleReportsImpl(Task task) { super(SingleFileReport.class, task); add(CustomizableHtmlReportImpl.class, "html", task); add(TaskGeneratedSingleFileReport.class, "xml", task); }
@Internal SingleFileReport getFirstEnabled();
public JDependReportsImpl(Task task) { super(SingleFileReport.class, task); add(TaskGeneratedSingleFileReport.class, "xml", task); add(TaskGeneratedSingleFileReport.class, "text", task); }
public SingleFileReport getText() { return getByName("text"); }
public SingleFileReport getEmacs() { return getByName("emacs"); }
public SingleFileReport getXml() { return (SingleFileReport)getByName("xml"); }
public SingleFileReport getCsv() { return (SingleFileReport)getByName("csv"); }
public CheckstyleReportsImpl(Task task) { super(SingleFileReport.class, task); add(TaskGeneratedSingleFileReport.class, "xml", task); }