diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-08-16 14:00:09 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-08-16 14:00:09 +0200 |
commit | 6ed0c6c21ad38ece31a96c9db3e2fdfa0e07eb21 (patch) | |
tree | b7a670c274dff1a01aeafad4f85de37266ae248a /plugins | |
parent | 424cffa7da8a34ab30cf4426cb3ee897ba01c743 (diff) | |
download | sonarqube-6ed0c6c21ad38ece31a96c9db3e2fdfa0e07eb21.tar.gz sonarqube-6ed0c6c21ad38ece31a96c9db3e2fdfa0e07eb21.zip |
Fix some quality flaws
Diffstat (limited to 'plugins')
5 files changed, 13 insertions, 10 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java index 8171683a356..e521d627380 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java @@ -29,6 +29,9 @@ import org.sonar.api.resources.ResourceTypeTree; @InstantiationStrategy(InstantiationStrategy.PER_BATCH) public final class DefaultResourceTypes extends ExtensionProvider implements BatchExtension, ServerExtension { + + private static final String SUPPORTS_MEASURE_FILTERS = "supportsMeasureFilters"; + @Override public ResourceTypeTree provide() { return ResourceTypeTree.builder() @@ -38,30 +41,30 @@ public final class DefaultResourceTypes extends ExtensionProvider implements Bat .setProperty("modifiable_history", true) .setProperty("hasRolePolicy", true) .setProperty("updatable_key", true) - .setProperty("supportsMeasureFilters", true) + .setProperty(SUPPORTS_MEASURE_FILTERS, true) .setProperty("comparable", true) .setProperty("configurable", true) .build()) .addType(ResourceType.builder(Qualifiers.MODULE) .setProperty("updatable_key", true) - .setProperty("supportsMeasureFilters", true) + .setProperty(SUPPORTS_MEASURE_FILTERS, true) .setProperty("configurable", true) .build()) .addType(ResourceType.builder(Qualifiers.DIRECTORY) - .setProperty("supportsMeasureFilters", true) + .setProperty(SUPPORTS_MEASURE_FILTERS, true) .build()) .addType(ResourceType.builder(Qualifiers.PACKAGE) .build()) .addType(ResourceType.builder(Qualifiers.FILE) .hasSourceCode() - .setProperty("supportsMeasureFilters", true) + .setProperty(SUPPORTS_MEASURE_FILTERS, true) .build()) .addType(ResourceType.builder(Qualifiers.CLASS) .hasSourceCode() .build()) .addType(ResourceType.builder(Qualifiers.UNIT_TEST_FILE) .hasSourceCode() - .setProperty("supportsMeasureFilters", true) + .setProperty(SUPPORTS_MEASURE_FILTERS, true) .build()) .addRelations(Qualifiers.PROJECT, Qualifiers.MODULE) 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 58b7ba469c7..6b8f9f191fb 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 @@ -52,7 +52,7 @@ public final class NewCoverageAggregator implements Decorator { public void decorate(Resource resource, DecoratorContext context) { if (shouldDecorate(resource)) { - int maxPeriods = (Qualifiers.isView(resource, true) ? 3 : 5); + int maxPeriods = Qualifiers.isView(resource, true) ? 3 : 5; aggregate(context, CoreMetrics.NEW_LINES_TO_COVER, maxPeriods); aggregate(context, CoreMetrics.NEW_UNCOVERED_LINES, maxPeriods); aggregate(context, CoreMetrics.NEW_CONDITIONS_TO_COVER, maxPeriods); diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/batch/SuspectLcom4DensityDecorator.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/batch/SuspectLcom4DensityDecorator.java index 7b0ee4a1949..b722957d1c2 100644 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/batch/SuspectLcom4DensityDecorator.java +++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/batch/SuspectLcom4DensityDecorator.java @@ -73,7 +73,7 @@ public class SuspectLcom4DensityDecorator implements Decorator { } if (hasLcom4 && totalFiles > 0) { - context.saveMeasure(CoreMetrics.SUSPECT_LCOM4_DENSITY, (total / totalFiles)); + context.saveMeasure(CoreMetrics.SUSPECT_LCOM4_DENSITY, total / totalFiles); } } diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/Dsm.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/Dsm.java index 9539a9c96ce..1dad1fa06c5 100644 --- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/Dsm.java +++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/ui/page/client/Dsm.java @@ -289,7 +289,7 @@ public class Dsm extends Composite { private Label createNonDiagonalCell(final int row, final int col, int weight) { Label cell; - cell = buildCell(row, col, weight, (col > row ? GRID_CELL_TOP_RIGHT : GRID_CELL_BOTTOM_LEFT)); + cell = buildCell(row, col, weight, col > row ? GRID_CELL_TOP_RIGHT : GRID_CELL_BOTTOM_LEFT); if (weight > 0) { String tooltip = data.get(col).getName() + " -> " + data.get(row).getName() + " (" + weight + "). " + Dictionary.getDictionary("l10n").get("design.cellTooltip"); diff --git a/plugins/sonar-maven-batch-plugin/src/main/java/org/sonar/plugins/maven/DefaultMavenPluginExecutor.java b/plugins/sonar-maven-batch-plugin/src/main/java/org/sonar/plugins/maven/DefaultMavenPluginExecutor.java index f1e532514ea..4dea1968071 100644 --- a/plugins/sonar-maven-batch-plugin/src/main/java/org/sonar/plugins/maven/DefaultMavenPluginExecutor.java +++ b/plugins/sonar-maven-batch-plugin/src/main/java/org/sonar/plugins/maven/DefaultMavenPluginExecutor.java @@ -57,7 +57,7 @@ public class DefaultMavenPluginExecutor implements MavenPluginExecutor { MavenPlugin plugin = MavenPlugin.getPlugin(project.getPom(), handler.getGroupId(), handler.getArtifactId()); execute(project, fs, - getGoal(handler.getGroupId(), handler.getArtifactId(), (plugin != null && plugin.getPlugin() != null ? plugin.getPlugin().getVersion() : null), goal)); + getGoal(handler.getGroupId(), handler.getArtifactId(), plugin != null && plugin.getPlugin() != null ? plugin.getPlugin().getVersion() : null, goal)); } return handler; } @@ -82,7 +82,7 @@ public class DefaultMavenPluginExecutor implements MavenPluginExecutor { } static String getGoal(String groupId, String artifactId, @Nullable String version, String goal) { - String defaultVersion = (version == null ? "" : version); + String defaultVersion = version == null ? "" : version; return new StringBuilder() .append(groupId).append(":") .append(artifactId).append(":") |