]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5812 Remove the "accessors" metric
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 26 Mar 2018 13:20:11 +0000 (15:20 +0200)
committerSonarTech <sonartech@sonarsource.com>
Wed, 28 Mar 2018 18:20:59 +0000 (20:20 +0200)
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/SizeMeasuresStep.java
server/sonar-server/src/main/resources/org/sonar/server/batch/global-example.json [deleted file]
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportSizeMeasuresStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsSizeMeasuresStepTest.java
sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java
sonar-core/src/test/java/org/sonar/core/metric/ScannerMetricsTest.java
sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java

index 3fbba51cf3e6033428fab3c9c5ba5c61a4e607e4..4ed2db87a6705c09df9fbe7a3a5038c78dd32133 100644 (file)
  */
 package org.sonar.server.computation.task.projectanalysis.step;
 
-import static org.sonar.api.measures.CoreMetrics.ACCESSORS_KEY;
-import static org.sonar.api.measures.CoreMetrics.CLASSES_KEY;
-import static org.sonar.api.measures.CoreMetrics.DIRECTORIES_KEY;
-import static org.sonar.api.measures.CoreMetrics.FILES_KEY;
-import static org.sonar.api.measures.CoreMetrics.FUNCTIONS_KEY;
-import static org.sonar.api.measures.CoreMetrics.GENERATED_LINES_KEY;
-import static org.sonar.api.measures.CoreMetrics.GENERATED_NCLOC_KEY;
-import static org.sonar.api.measures.CoreMetrics.LINES_KEY;
-import static org.sonar.api.measures.CoreMetrics.NCLOC_KEY;
-import static org.sonar.api.measures.CoreMetrics.STATEMENTS_KEY;
-import static org.sonar.server.computation.task.projectanalysis.component.ComponentVisitor.Order.POST_ORDER;
-import static org.sonar.server.computation.task.projectanalysis.formula.SumFormula.createIntSumFormula;
-import static org.sonar.server.computation.task.projectanalysis.measure.Measure.newMeasureBuilder;
-
+import com.google.common.base.Optional;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-
 import org.sonar.server.computation.task.projectanalysis.component.Component;
 import org.sonar.server.computation.task.projectanalysis.component.CrawlerDepthLimit;
 import org.sonar.server.computation.task.projectanalysis.component.PathAwareCrawler;
@@ -50,7 +36,18 @@ import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepository;
 import org.sonar.server.computation.task.step.ComputationStep;
 
-import com.google.common.base.Optional;
+import static org.sonar.api.measures.CoreMetrics.CLASSES_KEY;
+import static org.sonar.api.measures.CoreMetrics.DIRECTORIES_KEY;
+import static org.sonar.api.measures.CoreMetrics.FILES_KEY;
+import static org.sonar.api.measures.CoreMetrics.FUNCTIONS_KEY;
+import static org.sonar.api.measures.CoreMetrics.GENERATED_LINES_KEY;
+import static org.sonar.api.measures.CoreMetrics.GENERATED_NCLOC_KEY;
+import static org.sonar.api.measures.CoreMetrics.LINES_KEY;
+import static org.sonar.api.measures.CoreMetrics.NCLOC_KEY;
+import static org.sonar.api.measures.CoreMetrics.STATEMENTS_KEY;
+import static org.sonar.server.computation.task.projectanalysis.component.ComponentVisitor.Order.POST_ORDER;
+import static org.sonar.server.computation.task.projectanalysis.formula.SumFormula.createIntSumFormula;
+import static org.sonar.server.computation.task.projectanalysis.measure.Measure.newMeasureBuilder;
 
 /**
  * Compute size measures
@@ -63,8 +60,7 @@ public class SizeMeasuresStep implements ComputationStep {
     createIntSumFormula(GENERATED_NCLOC_KEY),
     createIntSumFormula(FUNCTIONS_KEY),
     createIntSumFormula(STATEMENTS_KEY),
-    createIntSumFormula(CLASSES_KEY),
-    createIntSumFormula(ACCESSORS_KEY)));
+    createIntSumFormula(CLASSES_KEY)));
 
   private final TreeRootHolder treeRootHolder;
   private final MetricRepository metricRepository;
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/batch/global-example.json b/server/sonar-server/src/main/resources/org/sonar/server/batch/global-example.json
deleted file mode 100644 (file)
index 457df48..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-{
-  "timestamp": 0,
-  "metrics": [
-    {
-      "id": 11,
-      "key": "accessors",
-      "valueType": "INT",
-      "description": "Accessors",
-      "direction": -1,
-      "name": "accessors",
-      "qualitative": false,
-      "userManaged": false,
-      "optimizedBestValue": false
-    },
-    {
-      "id": 93,
-      "key": "blocker_violations",
-      "valueType": "INT",
-      "description": "Blocker issues",
-      "direction": -1,
-      "name": "blocker_violations",
-      "qualitative": true,
-      "userManaged": false,
-      "bestValue": 0.0,
-      "optimizedBestValue": true
-    },
-    {
-      "id": 45,
-      "key": "conditions_to_cover",
-      "valueType": "INT",
-      "description": "Branches to cover",
-      "direction": 0,
-      "name": "conditions_to_cover",
-      "qualitative": false,
-      "userManaged": false,
-      "optimizedBestValue": false
-    },
-    {
-      "id": 63,
-      "key": "new_it_conditions_to_cover",
-      "valueType": "INT",
-      "description": "Branches to cover by Integration Tests on new code",
-      "direction": 0,
-      "name": "new_it_conditions_to_cover",
-      "qualitative": false,
-      "userManaged": false,
-      "optimizedBestValue": false
-    },
-    {
-      "id": 46,
-      "key": "new_conditions_to_cover",
-      "valueType": "INT",
-      "description": "Branches to cover on new code",
-      "direction": 0,
-      "name": "new_conditions_to_cover",
-      "qualitative": false,
-      "userManaged": false,
-      "optimizedBestValue": false
-    },
-    {
-      "id": 122,
-      "key": "burned_budget",
-      "valueType": "FLOAT",
-      "direction": 0,
-      "name": "burned_budget",
-      "qualitative": false,
-      "userManaged": true,
-      "optimizedBestValue": false
-    },
-    {
-      "id": 123,
-      "key": "business_value",
-      "valueType": "FLOAT",
-      "direction": 1,
-      "name": "business_value",
-      "qualitative": true,
-      "userManaged": true,
-      "optimizedBestValue": false
-    },
-    {
-      "id": 6,
-      "key": "classes",
-      "valueType": "INT",
-      "description": "Classes",
-      "direction": -1,
-      "name": "classes",
-      "qualitative": false,
-      "userManaged": false,
-      "optimizedBestValue": false
-    },
-    {
-      "id": 23,
-      "key": "class_complexity",
-      "valueType": "FLOAT",
-      "description": "Complexity average by class",
-      "direction": -1,
-      "name": "class_complexity",
-      "qualitative": true,
-      "userManaged": false,
-      "optimizedBestValue": false
-    }
-  ],
-  "globalSettings": {
-    "sonar.permission.template.default": "default_template",
-    "sonar.core.startTime": "2015-11-02T09:22:09+0100",
-    "sonar.core.id": "20151102092209",
-    "sonar.core.version": "5.3-SNAPSHOT",
-    "sonar.qualitygate": "1"
-  }
-}
index 8e1cefe977f6f6ba47fe35b4c8b8e4296bd0783e..af45b32c4a49aed1e159174557892dbb8fd37b10 100644 (file)
@@ -102,8 +102,7 @@ public class ReportSizeMeasuresStepTest {
     .add(CoreMetrics.GENERATED_NCLOC)
     .add(CoreMetrics.FUNCTIONS)
     .add(CoreMetrics.STATEMENTS)
-    .add(CoreMetrics.CLASSES)
-    .add(CoreMetrics.ACCESSORS);
+    .add(CoreMetrics.CLASSES);
   @Rule
   public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
 
index e7e35bebdfe70a87a07823a9ccc36fc1667f05e3..dc705c389781dfdd52aef4bd095553d3dedef848 100644 (file)
@@ -32,7 +32,6 @@ import static com.google.common.collect.FluentIterable.from;
 import static com.google.common.collect.Iterables.concat;
 import static java.util.Arrays.asList;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.api.measures.CoreMetrics.ACCESSORS;
 import static org.sonar.api.measures.CoreMetrics.CLASSES;
 import static org.sonar.api.measures.CoreMetrics.CLASSES_KEY;
 import static org.sonar.api.measures.CoreMetrics.DIRECTORIES;
@@ -105,8 +104,7 @@ public class ViewsSizeMeasuresStepTest {
     .add(GENERATED_NCLOC)
     .add(FUNCTIONS)
     .add(STATEMENTS)
-    .add(CLASSES)
-    .add(ACCESSORS);
+    .add(CLASSES);
   @Rule
   public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository)
     .addRawMeasure(PROJECTVIEW_1_REF, LINES_KEY, newMeasureBuilder().create(1))
index 40d120ca97fa7a2bbc85987e4a6a45fbb36c5fe8..9da45b54375530226b4e5aa1068d285817dbd0ab 100644 (file)
@@ -33,7 +33,6 @@ import org.sonar.api.ce.ComputeEngineSide;
 import org.sonar.api.measures.Metric;
 import org.sonar.api.measures.Metrics;
 
-import static org.sonar.api.measures.CoreMetrics.ACCESSORS;
 import static org.sonar.api.measures.CoreMetrics.CLASSES;
 import static org.sonar.api.measures.CoreMetrics.COGNITIVE_COMPLEXITY;
 import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES;
@@ -96,7 +95,6 @@ public class ScannerMetrics {
     CLASSES,
     FUNCTIONS,
     STATEMENTS,
-    ACCESSORS,
 
     COMPLEXITY,
     COMPLEXITY_IN_CLASSES,
index 13b28cd3280fff7374345ded9b481c0cea705958..602341a74d51ccc674e22afa429f21dcb5ae7e6e 100644 (file)
@@ -34,12 +34,12 @@ public class ScannerMetricsTest {
   private static final List<Metric> SENSOR_METRICS_WITHOUT_METRIC_PLUGIN = metrics();
 
   @Test
-  public void check_number_of_allowed_core_metrics() throws Exception {
-    assertThat(SENSOR_METRICS_WITHOUT_METRIC_PLUGIN).hasSize(34);
+  public void check_number_of_allowed_core_metrics() {
+    assertThat(SENSOR_METRICS_WITHOUT_METRIC_PLUGIN).hasSize(33);
   }
 
   @Test
-  public void check_metrics_from_plugin() throws Exception {
+  public void check_metrics_from_plugin() {
     List<Metric> metrics = metrics(new FakeMetrics());
     metrics.removeAll(SENSOR_METRICS_WITHOUT_METRIC_PLUGIN);
     assertThat(metrics).hasSize(2);
index 2c1545efbd13a0c4f8f95d0545f37aeb4f288ec4..1bf18339e21a728fc60478b6b8c1ac48161b07c1 100644 (file)
@@ -209,26 +209,6 @@ public final class CoreMetrics {
     .setDomain(DOMAIN_SIZE)
     .create();
 
-  /**
-   * @deprecated since 5.0.
-   * @see <a href="https://jira.sonarsource.com/browse/SONAR-5224">SONAR-5224</a>
-   */
-  @Deprecated
-  public static final String ACCESSORS_KEY = "accessors";
-
-  /**
-   * @deprecated since 5.0.
-   * @see <a href="https://jira.sonarsource.com/browse/SONAR-5224">SONAR-5224</a>
-   */
-  @Deprecated
-  public static final Metric<Integer> ACCESSORS = new Metric.Builder(ACCESSORS_KEY, "Accessors", Metric.ValueType.INT)
-    .setDescription("Accessors")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .setHidden(true)
-    .create();
-
   public static final String STATEMENTS_KEY = "statements";
   public static final Metric<Integer> STATEMENTS = new Metric.Builder(STATEMENTS_KEY, "Statements", Metric.ValueType.INT)
     .setDescription("Number of statements")
index bc63f7c7c7bb0c780f5ea8d654f16d978cef36f3..298d12fa25a7b5fb4421ec22cccb6a58cbfd6c1c 100644 (file)
@@ -45,13 +45,13 @@ public class CoreMetricsTest {
   }
 
   @Test
-  public void get_metric_by_key() throws Exception {
+  public void get_metric_by_key() {
     Metric metric = getMetric("ncloc");
     assertThat(metric.getKey()).isEqualTo("ncloc");
   }
 
   @Test
-  public void fail_get_unknown_metric_by_key() throws Exception {
+  public void fail_get_unknown_metric_by_key() {
     expectedException.expect(NoSuchElementException.class);
     getMetric("unknown");
   }