diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-06-19 11:40:14 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-06-19 11:40:52 +0200 |
commit | bbf1f60af78c263234c3411b4c0cc29a13c65451 (patch) | |
tree | 955113cb62ff7ef54a4d112b0fc31ae3c63c818c /plugins | |
parent | 32f8bfbdacdb68a37ef5944ad8388755c7dc5b6b (diff) | |
download | sonarqube-bbf1f60af78c263234c3411b4c0cc29a13c65451.tar.gz sonarqube-bbf1f60af78c263234c3411b4c0cc29a13c65451.zip |
SONAR-5389 Fix some quality flaws
Diffstat (limited to 'plugins')
18 files changed, 60 insertions, 57 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountUnresolvedIssuesDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountUnresolvedIssuesDecorator.java index 00c145353dd..d82a34e6c99 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountUnresolvedIssuesDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountUnresolvedIssuesDecorator.java @@ -85,7 +85,7 @@ public class CountUnresolvedIssuesDecorator implements Decorator { @DependedUpon public List<Metric> generatesIssuesMetrics() { - return ImmutableList.of( + return ImmutableList.<Metric>of( CoreMetrics.VIOLATIONS, CoreMetrics.BLOCKER_VIOLATIONS, CoreMetrics.CRITICAL_VIOLATIONS, diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssuesDensityDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssuesDensityDecorator.java index 0fd2b10d0c6..a804bbd9a42 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssuesDensityDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssuesDensityDecorator.java @@ -19,7 +19,11 @@ */ package org.sonar.plugins.core.issue; -import org.sonar.api.batch.*; +import org.sonar.api.batch.Decorator; +import org.sonar.api.batch.DecoratorBarriers; +import org.sonar.api.batch.DecoratorContext; +import org.sonar.api.batch.DependedUpon; +import org.sonar.api.batch.DependsUpon; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; import org.sonar.api.measures.MeasureUtils; @@ -42,7 +46,7 @@ public class IssuesDensityDecorator implements Decorator { @DependsUpon public List<Metric> dependsUponWeightedIissuesAndNcloc() { - return Arrays.asList(CoreMetrics.WEIGHTED_VIOLATIONS, CoreMetrics.NCLOC); + return Arrays.<Metric>asList(CoreMetrics.WEIGHTED_VIOLATIONS, CoreMetrics.NCLOC); } @DependedUpon diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/WeightedIssuesDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/WeightedIssuesDecorator.java index e3172e5870c..a7af9d3ff29 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/WeightedIssuesDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/WeightedIssuesDecorator.java @@ -43,16 +43,14 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -@Properties( - @Property( - key = CoreProperties.CORE_RULE_WEIGHTS_PROPERTY, - defaultValue = CoreProperties.CORE_RULE_WEIGHTS_DEFAULT_VALUE, - name = "Rules weight", - description = "A weight is associated to each severity to emphasize the most critical issues.", - project = false, - global = true, - category = CoreProperties.CATEGORY_GENERAL) -) +@Properties(@Property( + key = CoreProperties.CORE_RULE_WEIGHTS_PROPERTY, + defaultValue = CoreProperties.CORE_RULE_WEIGHTS_DEFAULT_VALUE, + name = "Rules weight", + description = "A weight is associated to each severity to emphasize the most critical issues.", + project = false, + global = true, + category = CoreProperties.CATEGORY_GENERAL)) public class WeightedIssuesDecorator implements Decorator { private Settings settings; @@ -64,7 +62,7 @@ public class WeightedIssuesDecorator implements Decorator { @DependsUpon public List<Metric> dependsUponIssues() { - return Arrays.asList(CoreMetrics.BLOCKER_VIOLATIONS, CoreMetrics.CRITICAL_VIOLATIONS, + return Arrays.<Metric>asList(CoreMetrics.BLOCKER_VIOLATIONS, CoreMetrics.CRITICAL_VIOLATIONS, CoreMetrics.MAJOR_VIOLATIONS, CoreMetrics.MINOR_VIOLATIONS, CoreMetrics.INFO_VIOLATIONS); } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/BranchCoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/BranchCoverageDecorator.java index 36378cdf82d..951c1d383a1 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/BranchCoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/BranchCoverageDecorator.java @@ -31,8 +31,8 @@ import java.util.List; public final class BranchCoverageDecorator extends AbstractCoverageDecorator { @DependsUpon public List<Metric> dependsUponMetrics() { - return ImmutableList.of(CoreMetrics.UNCOVERED_CONDITIONS, CoreMetrics.CONDITIONS_TO_COVER, - CoreMetrics.NEW_UNCOVERED_CONDITIONS, CoreMetrics.NEW_CONDITIONS_TO_COVER); + return ImmutableList.<Metric>of(CoreMetrics.UNCOVERED_CONDITIONS, CoreMetrics.CONDITIONS_TO_COVER, + CoreMetrics.NEW_UNCOVERED_CONDITIONS, CoreMetrics.NEW_CONDITIONS_TO_COVER); } @Override diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CommentDensityDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CommentDensityDecorator.java index 65502c74449..3bba4a2a52d 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CommentDensityDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CommentDensityDecorator.java @@ -19,9 +19,6 @@ */ package org.sonar.plugins.core.sensors; -import java.util.Arrays; -import java.util.List; - import org.sonar.api.batch.Decorator; import org.sonar.api.batch.DecoratorContext; import org.sonar.api.batch.DependedUpon; @@ -33,16 +30,19 @@ import org.sonar.api.measures.Metric; import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; +import java.util.Arrays; +import java.util.List; + public class CommentDensityDecorator implements Decorator { @DependsUpon public List<Metric> dependsUponMetrics() { - return Arrays.asList(CoreMetrics.NCLOC, CoreMetrics.COMMENT_LINES, CoreMetrics.PUBLIC_API, CoreMetrics.PUBLIC_UNDOCUMENTED_API); + return Arrays.<Metric>asList(CoreMetrics.NCLOC, CoreMetrics.COMMENT_LINES, CoreMetrics.PUBLIC_API, CoreMetrics.PUBLIC_UNDOCUMENTED_API); } @DependedUpon public List<Metric> generatesMetrics() { - return Arrays.asList(CoreMetrics.COMMENT_LINES_DENSITY, CoreMetrics.PUBLIC_DOCUMENTED_API_DENSITY); + return Arrays.<Metric>asList(CoreMetrics.COMMENT_LINES_DENSITY, CoreMetrics.PUBLIC_DOCUMENTED_API_DENSITY); } public boolean shouldExecuteOnProject(Project project) { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CoverageDecorator.java index aa8804106c4..2d37d02dec9 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CoverageDecorator.java @@ -31,7 +31,7 @@ import java.util.Collection; public final class CoverageDecorator extends AbstractCoverageDecorator { @DependsUpon public Collection<Metric> usedMetrics() { - return ImmutableList.of(CoreMetrics.LINES_TO_COVER, CoreMetrics.UNCOVERED_LINES, CoreMetrics.NEW_LINES_TO_COVER, + return ImmutableList.<Metric>of(CoreMetrics.LINES_TO_COVER, CoreMetrics.UNCOVERED_LINES, CoreMetrics.NEW_LINES_TO_COVER, CoreMetrics.NEW_UNCOVERED_LINES, CoreMetrics.CONDITIONS_TO_COVER, CoreMetrics.UNCOVERED_CONDITIONS, CoreMetrics.NEW_CONDITIONS_TO_COVER, CoreMetrics.NEW_UNCOVERED_CONDITIONS); } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItBranchCoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItBranchCoverageDecorator.java index bd0c595d9a5..eb515e363a5 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItBranchCoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItBranchCoverageDecorator.java @@ -32,8 +32,8 @@ public final class ItBranchCoverageDecorator extends AbstractCoverageDecorator { @DependsUpon public List<Metric> dependsUponMetrics() { - return ImmutableList.of(CoreMetrics.IT_UNCOVERED_CONDITIONS, CoreMetrics.IT_CONDITIONS_TO_COVER, - CoreMetrics.NEW_IT_UNCOVERED_CONDITIONS, CoreMetrics.NEW_IT_CONDITIONS_TO_COVER); + return ImmutableList.<Metric>of(CoreMetrics.IT_UNCOVERED_CONDITIONS, CoreMetrics.IT_CONDITIONS_TO_COVER, + CoreMetrics.NEW_IT_UNCOVERED_CONDITIONS, CoreMetrics.NEW_IT_CONDITIONS_TO_COVER); } @Override diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItCoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItCoverageDecorator.java index 24d931c934d..a9bd603985a 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItCoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItCoverageDecorator.java @@ -31,9 +31,9 @@ import java.util.Collection; public final class ItCoverageDecorator extends AbstractCoverageDecorator { @DependsUpon public Collection<Metric> usedMetrics() { - return ImmutableList.of(CoreMetrics.IT_LINES_TO_COVER, CoreMetrics.IT_UNCOVERED_LINES, CoreMetrics.NEW_IT_LINES_TO_COVER, - CoreMetrics.NEW_IT_UNCOVERED_LINES, CoreMetrics.IT_CONDITIONS_TO_COVER, CoreMetrics.IT_UNCOVERED_CONDITIONS, - CoreMetrics.NEW_IT_CONDITIONS_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_CONDITIONS); + return ImmutableList.<Metric>of(CoreMetrics.IT_LINES_TO_COVER, CoreMetrics.IT_UNCOVERED_LINES, CoreMetrics.NEW_IT_LINES_TO_COVER, + CoreMetrics.NEW_IT_UNCOVERED_LINES, CoreMetrics.IT_CONDITIONS_TO_COVER, CoreMetrics.IT_UNCOVERED_CONDITIONS, + CoreMetrics.NEW_IT_CONDITIONS_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_CONDITIONS); } @Override diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItLineCoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItLineCoverageDecorator.java index f516d34537f..651d379c92e 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItLineCoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ItLineCoverageDecorator.java @@ -31,8 +31,8 @@ import java.util.List; public final class ItLineCoverageDecorator extends AbstractCoverageDecorator { @DependsUpon public List<Metric> dependsUponMetrics() { - return ImmutableList.of(CoreMetrics.IT_UNCOVERED_LINES, CoreMetrics.IT_LINES_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_LINES, - CoreMetrics.NEW_IT_LINES_TO_COVER); + return ImmutableList.<Metric>of(CoreMetrics.IT_UNCOVERED_LINES, CoreMetrics.IT_LINES_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_LINES, + CoreMetrics.NEW_IT_LINES_TO_COVER); } @Override diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/LineCoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/LineCoverageDecorator.java index d9db9c8d394..feaf04176cf 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/LineCoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/LineCoverageDecorator.java @@ -31,8 +31,8 @@ import java.util.List; public final class LineCoverageDecorator extends AbstractCoverageDecorator { @DependsUpon public List<Metric> dependsUponMetrics() { - return ImmutableList.of(CoreMetrics.UNCOVERED_LINES, CoreMetrics.LINES_TO_COVER, CoreMetrics.NEW_UNCOVERED_LINES, - CoreMetrics.NEW_LINES_TO_COVER); + return ImmutableList.<Metric>of(CoreMetrics.UNCOVERED_LINES, CoreMetrics.LINES_TO_COVER, CoreMetrics.NEW_UNCOVERED_LINES, + CoreMetrics.NEW_LINES_TO_COVER); } @Override diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallBranchCoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallBranchCoverageDecorator.java index 19e02290842..2c54896f22d 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallBranchCoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallBranchCoverageDecorator.java @@ -31,8 +31,8 @@ import java.util.List; public final class OverallBranchCoverageDecorator extends AbstractCoverageDecorator { @DependsUpon public List<Metric> dependsUponMetrics() { - return ImmutableList.of(CoreMetrics.OVERALL_UNCOVERED_CONDITIONS, CoreMetrics.OVERALL_CONDITIONS_TO_COVER, - CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS, CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER); + return ImmutableList.<Metric>of(CoreMetrics.OVERALL_UNCOVERED_CONDITIONS, CoreMetrics.OVERALL_CONDITIONS_TO_COVER, + CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS, CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER); } @Override diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallCoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallCoverageDecorator.java index dd106fd64e6..998e4b3ef24 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallCoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallCoverageDecorator.java @@ -31,9 +31,9 @@ import java.util.Collection; public final class OverallCoverageDecorator extends AbstractCoverageDecorator { @DependsUpon public Collection<Metric> usedMetrics() { - return ImmutableList.of(CoreMetrics.OVERALL_LINES_TO_COVER, CoreMetrics.OVERALL_UNCOVERED_LINES, CoreMetrics.NEW_OVERALL_LINES_TO_COVER, - CoreMetrics.NEW_OVERALL_UNCOVERED_LINES, CoreMetrics.OVERALL_CONDITIONS_TO_COVER, CoreMetrics.OVERALL_UNCOVERED_CONDITIONS, - CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS); + return ImmutableList.<Metric>of(CoreMetrics.OVERALL_LINES_TO_COVER, CoreMetrics.OVERALL_UNCOVERED_LINES, CoreMetrics.NEW_OVERALL_LINES_TO_COVER, + CoreMetrics.NEW_OVERALL_UNCOVERED_LINES, CoreMetrics.OVERALL_CONDITIONS_TO_COVER, CoreMetrics.OVERALL_UNCOVERED_CONDITIONS, + CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS); } @Override diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallLineCoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallLineCoverageDecorator.java index 35dc51718f0..a3ab283cf9d 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallLineCoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/OverallLineCoverageDecorator.java @@ -31,8 +31,8 @@ import java.util.List; public final class OverallLineCoverageDecorator extends AbstractCoverageDecorator { @DependsUpon public List<Metric> dependsUponMetrics() { - return ImmutableList.of(CoreMetrics.OVERALL_UNCOVERED_LINES, CoreMetrics.OVERALL_LINES_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_LINES, - CoreMetrics.NEW_OVERALL_LINES_TO_COVER); + return ImmutableList.<Metric>of(CoreMetrics.OVERALL_UNCOVERED_LINES, CoreMetrics.OVERALL_LINES_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_LINES, + CoreMetrics.NEW_OVERALL_LINES_TO_COVER); } @Override diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/UnitTestDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/UnitTestDecorator.java index 6fca0264d7d..3423b73ee21 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/UnitTestDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/UnitTestDecorator.java @@ -38,7 +38,7 @@ public class UnitTestDecorator implements Decorator { @DependedUpon public List<Metric> generatesMetrics() { - return Arrays.asList(CoreMetrics.TEST_EXECUTION_TIME, CoreMetrics.TESTS, CoreMetrics.TEST_ERRORS, CoreMetrics.TEST_FAILURES, CoreMetrics.TEST_SUCCESS_DENSITY); + return Arrays.<Metric>asList(CoreMetrics.TEST_EXECUTION_TIME, CoreMetrics.TESTS, CoreMetrics.TEST_ERRORS, CoreMetrics.TEST_FAILURES, CoreMetrics.TEST_SUCCESS_DENSITY); } public boolean shouldExecuteOnProject(Project project) { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewCoverageAggregator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewCoverageAggregator.java index cfd472d0d47..c23d303dbd2 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewCoverageAggregator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewCoverageAggregator.java @@ -44,7 +44,7 @@ public final class NewCoverageAggregator implements Decorator { @DependedUpon public List<Metric> generatesNewCoverageMetrics() { - return Arrays.asList( + return Arrays.<Metric>asList( CoreMetrics.NEW_LINES_TO_COVER, CoreMetrics.NEW_UNCOVERED_LINES, CoreMetrics.NEW_CONDITIONS_TO_COVER, CoreMetrics.NEW_UNCOVERED_CONDITIONS, CoreMetrics.NEW_IT_LINES_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_LINES, CoreMetrics.NEW_IT_CONDITIONS_TO_COVER, CoreMetrics.NEW_IT_UNCOVERED_CONDITIONS, CoreMetrics.NEW_OVERALL_LINES_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_LINES, CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS); @@ -69,23 +69,23 @@ public final class NewCoverageAggregator implements Decorator { } void aggregate(DecoratorContext context, Metric metric, int maxPeriods) { - int[] variations = {0,0,0,0,0}; - boolean[] hasValues = {false,false,false,false,false}; + int[] variations = {0, 0, 0, 0, 0}; + boolean[] hasValues = {false, false, false, false, false}; for (Measure child : context.getChildrenMeasures(metric)) { - for (int indexPeriod=1 ; indexPeriod<=maxPeriods ; indexPeriod++) { + for (int indexPeriod = 1; indexPeriod <= maxPeriods; indexPeriod++) { Double variation = child.getVariation(indexPeriod); - if (variation!=null) { - variations[indexPeriod-1]=variations[indexPeriod-1] + variation.intValue(); - hasValues[indexPeriod-1]=true; + if (variation != null) { + variations[indexPeriod - 1] = variations[indexPeriod - 1] + variation.intValue(); + hasValues[indexPeriod - 1] = true; } } } if (ArrayUtils.contains(hasValues, true)) { Measure measure = new Measure(metric); - for (int index=0 ; index<5 ; index++) { + for (int index = 0; index < 5; index++) { if (hasValues[index]) { - measure.setVariation(index+1, (double)variations[index]); + measure.setVariation(index + 1, (double) variations[index]); } } context.saveMeasure(measure); diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyDecoratorTest.java index 8713c66537b..4240fa71bd7 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyDecoratorTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TendencyDecoratorTest.java @@ -20,11 +20,13 @@ package org.sonar.plugins.core.timemachine; import org.junit.Test; +import org.junit.matchers.JUnitMatchers; import org.sonar.api.batch.DecoratorContext; import org.sonar.api.batch.TimeMachine; import org.sonar.api.batch.TimeMachineQuery; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; +import org.sonar.api.measures.Metric; import org.sonar.api.measures.MetricFinder; import org.sonar.api.resources.Directory; import org.sonar.api.resources.Project; @@ -36,7 +38,6 @@ import java.util.Date; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.matchers.JUnitMatchers.hasItems; import static org.mockito.Matchers.anyList; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -51,13 +52,13 @@ public class TendencyDecoratorTest { when(project.getAnalysisDate()).thenReturn(date("2009-12-25")); MetricFinder metricFinder = mock(MetricFinder.class); - when(metricFinder.findAll()).thenReturn(Arrays.asList(CoreMetrics.LINES, CoreMetrics.COVERAGE, CoreMetrics.COVERAGE_LINE_HITS_DATA, CoreMetrics.PROFILE)); + when(metricFinder.findAll()).thenReturn(Arrays.<Metric>asList(CoreMetrics.LINES, CoreMetrics.COVERAGE, CoreMetrics.COVERAGE_LINE_HITS_DATA, CoreMetrics.PROFILE)); TendencyDecorator decorator = new TendencyDecorator(null, metricFinder); TimeMachineQuery query = decorator.initQuery(project); assertThat(query.getMetrics().size(), is(2)); - assertThat(query.getMetrics(), hasItems(CoreMetrics.LINES, CoreMetrics.COVERAGE)); + assertThat(query.getMetrics(), JUnitMatchers.<Metric>hasItems(CoreMetrics.LINES, CoreMetrics.COVERAGE)); assertThat(query.getFrom(), is(date("2009-11-25"))); assertThat(query.isToCurrentAnalysis(), is(true)); } diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/DuplicationDensityDecorator.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/DuplicationDensityDecorator.java index de5b307c3f1..bea536ce8d0 100644 --- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/DuplicationDensityDecorator.java +++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/DuplicationDensityDecorator.java @@ -36,11 +36,11 @@ public class DuplicationDensityDecorator implements Decorator { @DependsUpon public List<Metric> dependsUponMetrics() { - return Arrays.asList( - CoreMetrics.NCLOC, - CoreMetrics.COMMENT_LINES, - CoreMetrics.DUPLICATED_LINES, - CoreMetrics.LINES); + return Arrays.<Metric>asList( + CoreMetrics.NCLOC, + CoreMetrics.COMMENT_LINES, + CoreMetrics.DUPLICATED_LINES, + CoreMetrics.LINES); } @DependedUpon diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/SumDuplicationsDecorator.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/SumDuplicationsDecorator.java index ffb168dcd16..29110918beb 100644 --- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/SumDuplicationsDecorator.java +++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/SumDuplicationsDecorator.java @@ -35,7 +35,7 @@ public class SumDuplicationsDecorator extends AbstractSumChildrenDecorator { @Override @DependedUpon public List<Metric> generatesMetrics() { - return Arrays.asList(CoreMetrics.DUPLICATED_BLOCKS, CoreMetrics.DUPLICATED_FILES, CoreMetrics.DUPLICATED_LINES); + return Arrays.<Metric>asList(CoreMetrics.DUPLICATED_BLOCKS, CoreMetrics.DUPLICATED_FILES, CoreMetrics.DUPLICATED_LINES); } @Override |