private void init() { for (MavenBuild b : mavenBuild.getModuleLastBuilds().values()) { ViolationsBuildAction a = b.getAction(ViolationsBuildAction.class); if (a == null || a.getReport() == null) { continue; } ViolationsModuleReport r = new ViolationsModuleReport(b, a.getReport()); reports.add(r); HealthReport x = a.getReport().getBuildHealth(); HealthReport aReport = null; if (x != null) { aReport = new HealthReport( x.getScore(), Messages._ViolationsAggregatedReport_HealthDescription( x.getDescription(), r.getDisplayName())); } if (aReport != null) { healthReport = HealthReport.min(healthReport, aReport); } setConfig(a.getReport().getConfig()); Map<String, Integer> aggregatedViolations = getViolations(); for (Map.Entry<String, Integer> e : a.getReport().getViolations().entrySet()) { int val = e.getValue(); Integer current = aggregatedViolations.get(e.getKey()); if (current == null) { aggregatedViolations.put(e.getKey(), e.getValue()); } else { aggregatedViolations.put(e.getKey(), val + current); } } } }
public void observe(Item item) { if (item instanceof Folder) { // only interested in non-folders in order to prevent double counting return; } HealthReport report = getHealthReport(item); if (report != null && (worst == null || report.getScore() < worst.getScore())) { worst = new HealthReport( report.getScore(), report.getIconUrl(), Messages._Folder_HealthWrap( item.getFullDisplayName(), report.getLocalizableDescription())); } }
public List<HealthReport> report() { return worst != null && worst.getScore() < 100 ? Collections.singletonList(worst) : Collections.<HealthReport>emptyList(); }