Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
Fixed rules:
Browse files Browse the repository at this point in the history
Parsing should be used to convert "Strings" to primitives;
Collapsible "if" statements should be merged;
Collapsible "if" statements should be merged;
  • Loading branch information
SosoTughushi committed Jun 29, 2016
1 parent c3c6bb3 commit c429a76
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/main/java/hudson/plugins/analysis/core/FilesParser.java
Expand Up @@ -177,16 +177,18 @@ protected void log(final String message) {
* the message in singular or plural form depending on the count,
* or an empty string if the count is 0 and no format is specified
*/
protected String plural(final int count, String message) {
protected String plural(final int count, final String message) {
if (count == 0 && !message.contains("%")) {
return "";
}

String messageFormat = message;

if (count != 1) {
message += "s";
messageFormat += "s";
}

return String.format(message, count);
return String.format(messageFormat, count);
}

@Override
Expand Down
Expand Up @@ -186,10 +186,8 @@ protected abstract void persistValue(String value, String pluginName,
public Object getDynamic(final String graphId, final StaplerRequest request, final StaplerResponse response) {
try {
BuildResultGraph graph = configuration.getGraph(graphId);
if (hasMeaningfulGraph()) {
if (graph.isVisible()) {
return graph.getGraph(-1, configuration, null, buildHistory.getBaseline());
}
if (hasMeaningfulGraph() && graph.isVisible()) {
return graph.getGraph(-1, configuration, null, buildHistory.getBaseline());
}
response.sendRedirect2(request.getContextPath() + graph.getExampleImage());
}
Expand Down
Expand Up @@ -17,7 +17,7 @@ public class ThresholdValidator implements Validator {
public FormValidation check(final String value) throws FormValidation {
if (!StringUtils.isEmpty(value)) {
try {
int integer = Integer.valueOf(value);
int integer = Integer.parseInt(value);
if (integer < 0) {
throw FormValidation.error(Messages.FieldValidator_Error_Threshold());
}
Expand Down
Expand Up @@ -41,7 +41,7 @@ public static int defaultHeight(final String height) {
public FormValidation check(final String value) throws FormValidation {
if (!StringUtils.isEmpty(value)) {
try {
int integer = Integer.valueOf(value);
int integer = Integer.parseInt(value);
if (integer < MINIMUM_HEIGHT) {
throw FormValidation.error(Messages.FieldValidator_Error_TrendHeight(MINIMUM_HEIGHT));
}
Expand Down

0 comments on commit c429a76

Please sign in to comment.