]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 7 May 2015 13:20:08 +0000 (15:20 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 7 May 2015 13:20:08 +0000 (15:20 +0200)
server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java
server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSort.java
sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java
sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java

index 1a264f90ba516f9e2512826d6bdb97e0cc8f9af6..e4014d2955967f1815d7d6070e9563eccc98ad29 100644 (file)
@@ -172,8 +172,8 @@ public class DebtModelOperations implements ServerComponent {
       }
     });
     Integer nextPosition = moveUpOrDown ?
-      ((currentPosition > 0) ? (currentPosition - 1) : null) :
-      ((currentPosition < (rootCharacteristics.size() - 1)) ? (currentPosition + 1) : null);
+      (currentPosition > 0 ? currentPosition - 1 : null) :
+      ((currentPosition < rootCharacteristics.size() - 1) ? currentPosition + 1 : null);
     return (nextPosition != null) ? Iterables.get(rootCharacteristics, nextPosition) : null;
   }
 
index 08f8209bbd1106dc6c88982d02f9e68bdf221928..584234f1e3acc013bd49e10739dcbd76b7a13369 100644 (file)
@@ -123,7 +123,7 @@ class MeasureFilterSort {
 
   private String getMetricColumn() {
     if (metric.isNumericType()) {
-      return (period != null) ? ("pmsort.variation_value_" + period) : "pmsort.value";
+      return period != null ? "pmsort.variation_value_" + period : "pmsort.value";
     } else {
       return "pmsort.text_value";
     }
index d9912f45b4bbe1297017ff90c98f65ea4a655ebe..f4521d664a672e8700018df1d754f01c7c2621aa 100644 (file)
@@ -202,7 +202,7 @@ public final class DebtDecorator implements Decorator {
     public void add(@Nullable E key, Long value) {
       if (key != null) {
         Long currentValue = sumByKeys.get(key);
-        sumByKeys.put(key, (currentValue != null) ? (currentValue + value) : value);
+        sumByKeys.put(key, currentValue != null ? currentValue + value : value);
       }
     }
 
index 9089c44183621f403ef43a1c04483818e62bfc4d..05f2ba422d55310d8b7fa59e0b2118daebfbab6a 100644 (file)
@@ -114,15 +114,15 @@ public class Durations implements BatchComponent, ServerComponent {
   private String format(Locale locale, int days, int hours, int minutes, boolean isNegative){
     StringBuilder message = new StringBuilder();
     if (days > 0) {
-      message.append(message(locale, "work_duration.x_days", isNegative ? (-1 * days) : days));
+      message.append(message(locale, "work_duration.x_days", isNegative ? -1 * days : days));
     }
     if (displayHours(days, hours)) {
       addSpaceIfNeeded(message);
-      message.append(message(locale, "work_duration.x_hours", (isNegative && message.length() == 0) ? (-1 * hours) : hours));
+      message.append(message(locale, "work_duration.x_hours", isNegative && message.length() == 0 ? -1 * hours : hours));
     }
     if (displayMinutes(days, hours, minutes)) {
       addSpaceIfNeeded(message);
-      message.append(message(locale, "work_duration.x_minutes", (isNegative && message.length() == 0) ? (-1 * minutes) : minutes));
+      message.append(message(locale, "work_duration.x_minutes", isNegative && message.length() == 0 ? -1 * minutes : minutes));
     }
     return message.toString();
   }