Search in sources :

Example 1 with HealthReport

use of hudson.model.HealthReport in project violations-plugin by jenkinsci.

the class ViolationsReport method getBuildHealth.

/**
 * Get the overall health for the build.
 *
 * @return the health report, null if there are no counts.
 */
public HealthReport getBuildHealth() {
    List<HealthReport> reports = getBuildHealths();
    HealthReport ret = null;
    for (HealthReport report : reports) {
        ret = HealthReport.min(ret, report);
    }
    return ret;
}
Also used : HealthReport(hudson.model.HealthReport)

Example 2 with HealthReport

use of hudson.model.HealthReport in project violations-plugin by jenkinsci.

the class ViolationsAggregatedReport method init.

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);
            }
        }
    }
}
Also used : MavenBuild(hudson.maven.MavenBuild) ViolationsBuildAction(hudson.plugins.violations.ViolationsBuildAction) HealthReport(hudson.model.HealthReport) Map(java.util.Map)

Example 3 with HealthReport

use of hudson.model.HealthReport in project violations-plugin by jenkinsci.

the class ViolationsReport method getTypeReports.

/**
 * Get a map of type to type reports.
 *
 * @return a map of type to type reports.
 */
public Map<String, TypeReport> getTypeReports() {
    Map<String, TypeReport> ret = new TreeMap<String, TypeReport>();
    for (String t : violations.keySet()) {
        int c = violations.get(t);
        HealthReport health = getHealthReportFor(t);
        ret.put(t, new TypeReport(t, health.getIconUrl(), c));
    }
    return ret;
}
Also used : HealthReport(hudson.model.HealthReport) TreeMap(java.util.TreeMap)

Example 4 with HealthReport

use of hudson.model.HealthReport in project violations-plugin by jenkinsci.

the class ViolationsReport method getIcon.

/**
 * Get the icon for a type.
 *
 * @param t
 *            the type
 * @return the icon name.
 */
public String getIcon(String t) {
    violations.get(t);
    HealthReport h = getHealthReportFor(t);
    if (h == null) {
        return null;
    }
    return h.getIconUrl();
}
Also used : HealthReport(hudson.model.HealthReport)

Aggregations

HealthReport (hudson.model.HealthReport)4 MavenBuild (hudson.maven.MavenBuild)1 ViolationsBuildAction (hudson.plugins.violations.ViolationsBuildAction)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1