![JAR search and dependency download from the Maven repository](/logo.png)
hudson.plugins.analysis.collector.AnalysisResultSummary Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of analysis-collector Show documentation
Show all versions of analysis-collector Show documentation
This plug-in is an add-on for the plug-ins Checkstyle, Dry, FindBugs, PMD, Tasks, and Warnings:
the plug-in collects the different analysis results and shows the results in a combined trend graph.
Additionally, the plug-in provides health reporting and build stability based on these combined results.
The newest version!
package hudson.plugins.analysis.collector;
/**
* Creates the result summary for the collected analysis results. This summary will be
* shown in the summary.jelly script of the {@link AnalysisResultAction}.
*
* @author Ulli Hafner
*/
public final class AnalysisResultSummary {
/**
* Returns the message to show as the result summary.
*
* @param result
* the result
* @return the message
*/
public static String createSummary(final AnalysisResult result) {
StringBuilder summary = new StringBuilder();
int bugs = result.getNumberOfAnnotations();
summary.append(Messages.Analysis_ProjectAction_Name());
summary.append(": ");
if (bugs > 0) {
summary.append("");
}
if (bugs == 1) {
summary.append(Messages.Analysis_ResultAction_OneWarning());
}
else {
summary.append(Messages.Analysis_ResultAction_MultipleWarnings(bugs));
}
if (bugs > 0) {
summary.append("");
}
summary.append(".");
return summary.toString();
}
/**
* Returns the message to show as the result summary.
*
* @param result
* the result
* @return the message
*/
// CHECKSTYLE:CONSTANTS-OFF
public static String createDeltaMessage(final AnalysisResult result) {
StringBuilder summary = new StringBuilder();
if (result.getNumberOfNewWarnings() > 0) {
summary.append("");
if (result.getNumberOfNewWarnings() == 1) {
summary.append(Messages.Analysis_ResultAction_OneNewWarning());
}
else {
summary.append(Messages.Analysis_ResultAction_MultipleNewWarnings(result.getNumberOfNewWarnings()));
}
summary.append(" ");
}
if (result.getNumberOfFixedWarnings() > 0) {
summary.append("");
if (result.getNumberOfFixedWarnings() == 1) {
summary.append(Messages.Analysis_ResultAction_OneFixedWarning());
}
else {
summary.append(Messages.Analysis_ResultAction_MultipleFixedWarnings(result.getNumberOfFixedWarnings()));
}
summary.append(" ");
}
return summary.toString();
}
// CHECKSTYLE:CONSTANTS-ON
/**
* Instantiates a new result summary.
*/
private AnalysisResultSummary() {
// prevents instantiation
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy