diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-02-17 12:48:07 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-02-17 13:46:50 +0400 |
commit | 0aa289a5926819abf28961be3d2f1e772648e9fb (patch) | |
tree | 2b4e7df2d9c0c383ca532b57f59db3be5a991740 /sonar-plugin-api | |
parent | aa342c58f14c8bc402f69143e9451aaad878e6c3 (diff) | |
download | sonarqube-0aa289a5926819abf28961be3d2f1e772648e9fb.tar.gz sonarqube-0aa289a5926819abf28961be3d2f1e772648e9fb.zip |
Fix some quality flaws
Diffstat (limited to 'sonar-plugin-api')
6 files changed, 33 insertions, 38 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java index 3b91fda8397..f0a5cf93df6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java @@ -27,6 +27,7 @@ import org.sonar.api.database.BaseIdentifiable; import org.sonar.api.database.DatabaseSession; import javax.persistence.*; + import java.util.Date; /** @@ -39,12 +40,12 @@ public class Snapshot extends BaseIdentifiable { /** * This status is set on the snapshot at the beginning of the batch */ - public final static String STATUS_UNPROCESSED = "U"; + public static final String STATUS_UNPROCESSED = "U"; /** * This status is set on the snapshot at the end of the batch */ - public final static String STATUS_PROCESSED = "P"; + public static final String STATUS_PROCESSED = "P"; @Column(name = "project_id", updatable = true, nullable = true) private Integer resourceId; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java index ca3a6f4ffe0..44008b1b2be 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java @@ -38,7 +38,7 @@ public class Measure { /** * Default precision when saving a float type metric */ - public final static int DEFAULT_PRECISION = 1; + public static final int DEFAULT_PRECISION = 1; private Long id; // for internal use protected String metricKey; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java index 0eb8c454d42..44f452d0293 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java @@ -159,7 +159,7 @@ public final class MeasuresFilters { /** * Used for internal optimizations. */ - public static abstract class MetricFilter<M> implements MeasuresFilter<M> { + public abstract static class MetricFilter<M> implements MeasuresFilter<M> { private final String metricKey; protected MetricFilter(Metric metric) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java index 853bdd7446c..c51106adb25 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java @@ -19,24 +19,17 @@ */ package org.sonar.api.measures; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Transient; - import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.sonar.api.BatchExtension; import org.sonar.api.ServerExtension; +import javax.persistence.*; + /** * This class represents the definition of a metric in Sonar. - * + * * @since 1.10 */ @Table(name = "metrics") @@ -46,15 +39,15 @@ public class Metric implements ServerExtension, BatchExtension { /** * A metric bigger value means a degradation */ - public final static int DIRECTION_WORST = -1; + public static final int DIRECTION_WORST = -1; /** * A metric bigger value means an improvement */ - public final static int DIRECTION_BETTER = 1; + public static final int DIRECTION_BETTER = 1; /** * The metric direction has no meaning */ - public final static int DIRECTION_NONE = 0; + public static final int DIRECTION_NONE = 0; public enum ValueType { INT, FLOAT, PERCENT, BOOL, STRING, MILLISEC, DATA, LEVEL, DISTRIB, RATING @@ -593,8 +586,8 @@ public class Metric implements ServerExtension, BatchExtension { } /** - * Metric.Builder is used to create metric definitions. It must be preferred to creating new instances of the Metric class directly. - * + * Metric.Builder is used to create metric definitions. It must be preferred to creating new instances of the Metric class directly. + * * @since 2.7 */ public static final class Builder { @@ -615,7 +608,7 @@ public class Metric implements ServerExtension, BatchExtension { /** * Creates a new {@link Builder} object. - * + * * @param key the metric key, should be unique among all metrics * @param name the metric name * @param type the metric type @@ -637,7 +630,7 @@ public class Metric implements ServerExtension, BatchExtension { /** * Sets the metric description. - * + * * @param d the description * @return the builder */ @@ -658,7 +651,7 @@ public class Metric implements ServerExtension, BatchExtension { * @see Metric#DIRECTION_WORST * @see Metric#DIRECTION_BETTER * @see Metric#DIRECTION_NONE - * + * * @param d the direction * @return the builder */ @@ -671,7 +664,7 @@ public class Metric implements ServerExtension, BatchExtension { * Sets whether the metric is qualitative or not. Default value is false. * <br/> * If set to true, then variations of this metric will be highlighted in the Web UI (for instance, trend icons will be red or green instead of default grey). - * + * * @param b Boolean.TRUE if the metric is qualitative * @return the builder */ @@ -684,7 +677,7 @@ public class Metric implements ServerExtension, BatchExtension { * Sets the domain for the metric (General, Complexity...). This is used to group metrics in the Web UI. * <br/> * By default, the metric belongs to no specific domain. - * + * * @param d the domain * @return the builder */ @@ -701,10 +694,10 @@ public class Metric implements ServerExtension, BatchExtension { * <br/> * When a formula is set, sensors/decorators just need to store measures at a specific level and let Sonar run the formula to store * measures on the remaining levels. - * - * @see {@link SumChildDistributionFormula}, {@link SumChildValuesFormula}, {@link AverageComplexityFormula}, {@link MeanAggregationFormula}, + * + * @see {@link SumChildDistributionFormula}, {@link SumChildValuesFormula}, {@link AverageComplexityFormula}, {@link MeanAggregationFormula}, * {@link WeightedMeanAggregationFormula} - * + * * @param f the formula * @return the builder */ @@ -715,7 +708,7 @@ public class Metric implements ServerExtension, BatchExtension { /** * Sets the worst value that the metric can get (example: 0.0 for code coverage). No worst value is set by default. - * + * * @param d the worst value * @return the builder */ @@ -728,7 +721,7 @@ public class Metric implements ServerExtension, BatchExtension { * Sets the best value that the metric can get (example: 100.0 for code coverage). No best value is set by default. * <br/> * Resources would be hidden on drilldown page, if the value of measure equals to best value. - * + * * @param d the best value * @return the builder */ @@ -740,9 +733,9 @@ public class Metric implements ServerExtension, BatchExtension { /** * Specifies whether file-level measures that equal to the defined best value are stored or not. Default is false. * <br/> - * Example with the metric that stores the number of violation ({@link CoreMetrics#VIOLATIONS}): + * Example with the metric that stores the number of violation ({@link CoreMetrics#VIOLATIONS}): * if a file has no violation, then the value '0' won't be stored in the database. - * + * * @param b true if the measures must not be stored when they equal to the best value * @return the builder */ @@ -753,7 +746,7 @@ public class Metric implements ServerExtension, BatchExtension { /** * Sets whether the metric should be hidden in Web UI (e.g. in Time Machine). Default is false. - * + * * @param b true if the metric should be hidden. * @return the builder */ @@ -766,9 +759,9 @@ public class Metric implements ServerExtension, BatchExtension { * Specifies whether this metric can be edited online in the "Manual measures" page. Default is false. * * @since 2.10 - * + * * @param b true if the metric can be edited online. - * @return the builder + * @return the builder */ public Builder setUserManaged(boolean b) { this.userManaged = b; @@ -781,7 +774,7 @@ public class Metric implements ServerExtension, BatchExtension { * By default, historical data are kept. * * @since 2.14 - * + * * @param b true if measures from the past can be deleted automatically. * @return the builder */ @@ -792,7 +785,7 @@ public class Metric implements ServerExtension, BatchExtension { /** * Creates a new metric definition based on the properties set on this metric builder. - * + * * @return a new {@link Metric} object */ public Metric create() { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java index 8a899c7444f..7c3b48bfc3b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java @@ -28,6 +28,7 @@ import org.sonar.api.database.DatabaseProperties; import org.sonar.check.Cardinality; import javax.persistence.*; + import java.util.ArrayList; import java.util.List; @@ -35,7 +36,7 @@ import java.util.List; @Table(name = "rules") public final class Rule { - private final static RulesCategory NONE = new RulesCategory("none"); + private static final RulesCategory NONE = new RulesCategory("none"); @Id @Column(name = "id") diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java index 7a8c893edb1..6f004c963ba 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java @@ -48,7 +48,7 @@ public final class KeyValueFormat { // only static methods } - public static abstract class Converter<TYPE> { + public abstract static class Converter<TYPE> { abstract String format(TYPE type); abstract TYPE parse(String s); |