From d6acdcd6cabef5dbf5a096733510b983a8ce21e5 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Fri, 10 Jul 2015 12:21:53 +0200 Subject: [PATCH] Move accessors formula to compute engine --- .../formula/CoreFormulaRepositoryImpl.java | 12 +++++++++--- .../java/org/sonar/api/measures/CoreMetrics.java | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImpl.java index 46dc36ad830..32a94674937 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImpl.java @@ -23,6 +23,7 @@ package org.sonar.server.computation.formula; import com.google.common.collect.ImmutableList; import java.util.List; +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.CLASS_COMPLEXITY_KEY; import static org.sonar.api.measures.CoreMetrics.COMPLEXITY_IN_CLASSES_KEY; @@ -41,8 +42,8 @@ import static org.sonar.api.measures.CoreMetrics.STATEMENTS_KEY; public class CoreFormulaRepositoryImpl implements CoreFormulaRepository { private static final List FORMULAS = ImmutableList.of( - // TODO When all decorators will be moved to CE, uncomment commented lines to activate all formulas and remove formulas declaration in - // {@link org.sonar.api.measures.CoreMetrics} + // TODO When all decorators will be moved to CE, uncomment commented lines to activate all formulas and remove formulas declaration in {@link org.sonar.api.measures.CoreMetrics} + // Sum formulas // new SumFormula(LINES_KEY), new SumFormula(GENERATED_LINES_KEY), @@ -56,7 +57,12 @@ public class CoreFormulaRepositoryImpl implements CoreFormulaRepository { // new SumFormula(PUBLIC_UNDOCUMENTED_API_KEY), new SumFormula(COMPLEXITY_KEY), new SumFormula(COMPLEXITY_IN_CLASSES_KEY), + // TODO this formula seems to be useless as this measure seems only required on files new SumFormula(COMPLEXITY_IN_FUNCTIONS_KEY), + + new SumFormula(ACCESSORS_KEY), +// new SumFormula(CoreMetrics.COMMENT_LINES_KEY), + // new SumFormula(LINES_TO_COVER_KEY), // new SumFormula(NEW_LINES_TO_COVER_KEY), // new SumFormula(UNCOVERED_LINES_KEY), @@ -101,7 +107,7 @@ public class CoreFormulaRepositoryImpl implements CoreFormulaRepository { .setByMetricKey(FUNCTIONS_KEY) .setFallbackMetricKey(COMPLEXITY_KEY) .build() - ); + ); /** * Return list of formulas that was previously provided by CoreMetrics diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java index 87346ae97ff..ea468baea8c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java @@ -178,7 +178,6 @@ public final class CoreMetrics { .setDirection(Metric.DIRECTION_WORST) .setQualitative(false) .setDomain(DOMAIN_SIZE) - .setFormula(new SumChildValuesFormula(false)) .setHidden(true) .create(); -- 2.39.5