aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-08-16 17:46:19 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-08-16 17:46:19 +0200
commit5793d47116097bbae05cd8811187ca1a0b362551 (patch)
treeecb4a1acf6ca8b299d4f76925c9f3e1ccf97ad1d /sonar-plugin-api/src
parent3125bcc453e3973298b7cf417b9ea8a158ba3b8a (diff)
downloadsonarqube-5793d47116097bbae05cd8811187ca1a0b362551.tar.gz
sonarqube-5793d47116097bbae05cd8811187ca1a0b362551.zip
Fix quality flaws
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/AverageFormula.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/MeanAggregationFormula.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/WeightedMeanAggregationFormula.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/TimeProfiler.java4
8 files changed, 13 insertions, 13 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/AverageFormula.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/AverageFormula.java
index 69dd9ccebbe..3ce086ad5d7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/AverageFormula.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/AverageFormula.java
@@ -110,7 +110,7 @@ public class AverageFormula implements Formula {
}
}
if (hasApplicableChildren) {
- result = new Measure(context.getTargetMetric(), (totalMainMeasure / totalByMeasure));
+ result = new Measure(context.getTargetMetric(), totalMainMeasure / totalByMeasure);
}
return result;
}
@@ -122,7 +122,7 @@ public class AverageFormula implements Formula {
Double byMeasure = MeasureUtils.getValue(data.getMeasure(byMetric), null);
Double mainMeasure = MeasureUtils.getValue(data.getMeasure(mainMetric), fallbackMeasure);
if (mainMeasure != null && byMeasure != null && byMeasure > 0.0) {
- result = new Measure(context.getTargetMetric(), (mainMeasure / byMeasure));
+ result = new Measure(context.getTargetMetric(), mainMeasure / byMeasure);
}
return result;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeanAggregationFormula.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeanAggregationFormula.java
index d6cf167b4f8..9d7bf817d89 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeanAggregationFormula.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeanAggregationFormula.java
@@ -58,6 +58,6 @@ public class MeanAggregationFormula implements Formula {
if (!hasValue && !forceZeroIfMissingData) {
return null;
}
- return new Measure(context.getTargetMetric(), (count==0 ? 0.0 : sum/count));
+ return new Measure(context.getTargetMetric(), count==0 ? 0.0 : sum/count);
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/WeightedMeanAggregationFormula.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/WeightedMeanAggregationFormula.java
index ca1e2007640..3cc202c14c8 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/WeightedMeanAggregationFormula.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/WeightedMeanAggregationFormula.java
@@ -51,7 +51,7 @@ public class WeightedMeanAggregationFormula implements Formula {
Measure measure = child.getMeasure(context.getTargetMetric());
Measure weightingMeasure = child.getMeasure(weightingMetric);
if (MeasureUtils.haveValues(measure, weightingMeasure)) {
- sum += (measure.getValue() * weightingMeasure.getValue());
+ sum += measure.getValue() * weightingMeasure.getValue();
count += weightingMeasure.getValue();
hasValue=true;
}
@@ -61,7 +61,7 @@ public class WeightedMeanAggregationFormula implements Formula {
return null;
}
- double result = (count==0.0 ? 0.0 : sum/count);
+ double result = count==0.0 ? 0.0 : sum/count;
return new Measure(context.getTargetMetric(), result);
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java
index 3b16ffecd9a..c42c4913360 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java
@@ -90,7 +90,7 @@ public abstract class AbstractLanguage implements Language {
@Override
public int hashCode() {
- return (key != null ? key.hashCode() : 0);
+ return key != null ? key.hashCode() : 0;
}
@Override
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
index ac3494b136b..0e93c6a00b8 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
@@ -175,7 +175,7 @@ public class Project extends Resource implements Component {
}
public Project getRoot() {
- return (parent == null ? this : parent.getRoot());
+ return parent==null ? this : parent.getRoot();
}
/**
@@ -318,7 +318,7 @@ public class Project extends Resource implements Component {
*/
@Deprecated
public boolean getReuseExistingRulesConfig() {
- return (configuration != null && configuration.getBoolean(CoreProperties.REUSE_RULES_CONFIGURATION_PROPERTY, false));
+ return configuration!=null && configuration.getBoolean(CoreProperties.REUSE_RULES_CONFIGURATION_PROPERTY, false);
}
/**
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java
index d4eb7b55533..5ac29fe00e2 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java
@@ -40,7 +40,7 @@ public final class AnnotationUtils {
* @since 3.1
*/
public static <A extends Annotation> A getAnnotation(Object objectOrClass, Class<A> annotationClass) {
- Class<?> initialClass = (objectOrClass instanceof Class<?> ? (Class<?>) objectOrClass : objectOrClass.getClass());
+ Class<?> initialClass = objectOrClass instanceof Class<?> ? (Class<?>) objectOrClass : objectOrClass.getClass();
for (Class<?> aClass = initialClass; aClass != null; aClass = aClass.getSuperclass()) {
A result = aClass.getAnnotation(annotationClass);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java
index 0fc31c4b18a..e233dadd227 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java
@@ -64,8 +64,8 @@ public class Paging {
* Number of pages. It is greater than or equal 0.
*/
public int pages() {
- int p = (total / pageSize);
- if ((total % pageSize) > 0) {
+ int p = total / pageSize;
+ if (total % pageSize > 0) {
p++;
}
return p;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TimeProfiler.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TimeProfiler.java
index 6cc911555bd..0b156cd2c48 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TimeProfiler.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TimeProfiler.java
@@ -81,9 +81,9 @@ public class TimeProfiler {
public TimeProfiler stop() {
if (start > 0) {
if (debug) {
- logger.debug("{} done: {} ms", name, (System.currentTimeMillis() - start));
+ logger.debug("{} done: {} ms", name, System.currentTimeMillis() - start);
} else {
- logger.info("{} done: {} ms", name, (System.currentTimeMillis() - start));
+ logger.info("{} done: {} ms", name, System.currentTimeMillis() - start);
}
}
start = 0;