aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-07-03 12:42:14 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-07-03 13:14:43 +0200
commit077bedd2ae941d320372c7c44a170be23a1679a5 (patch)
treedf174bc142d2102b00442f6e39b2a4007d91718c /sonar-plugin-api
parent8d9953d57840d24a7d99d6f263837eaf9ef6addf (diff)
downloadsonarqube-077bedd2ae941d320372c7c44a170be23a1679a5.tar.gz
sonarqube-077bedd2ae941d320372c7c44a170be23a1679a5.zip
SONAR-6680 Move computation of measure Quality Profile to Compute Engine
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java23
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java4
2 files changed, 8 insertions, 19 deletions
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 874c873ae25..87346ae97ff 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
@@ -22,16 +22,14 @@ package org.sonar.api.measures;
import com.google.common.annotations.Beta;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
-import org.sonar.api.resources.Scopes;
-import org.sonar.api.test.MutableTestPlan;
-import org.sonar.api.utils.SonarException;
-
-import javax.annotation.Nullable;
-
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.LinkedList;
import java.util.List;
+import javax.annotation.Nullable;
+import org.sonar.api.resources.Scopes;
+import org.sonar.api.test.MutableTestPlan;
+import org.sonar.api.utils.SonarException;
/**
* @since 1.10
@@ -77,7 +75,6 @@ public final class CoreMetrics {
.setDomain(DOMAIN_SIZE)
.setBestValue(0.0)
.setOptimizedBestValue(true)
- .setFormula(new SumChildValuesFormula(false))
.create();
public static final String NCLOC_KEY = "ncloc";
@@ -112,7 +109,6 @@ public final class CoreMetrics {
.setDomain(DOMAIN_SIZE)
.setBestValue(0.0)
.setOptimizedBestValue(true)
- .setFormula(new SumChildValuesFormula(false))
.create();
public static final String CLASSES_KEY = "classes";
@@ -121,7 +117,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
.setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
.create();
public static final String FILES_KEY = "files";
@@ -164,7 +159,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
.setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
.create();
/**
@@ -194,7 +188,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
.setDomain(DOMAIN_SIZE)
- .setFormula(new SumChildValuesFormula(false))
.create();
public static final String PUBLIC_API_KEY = "public_api";
@@ -300,7 +293,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
.setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildValuesFormula(false))
.create();
public static final String FILE_COMPLEXITY_KEY = "file_complexity";
@@ -309,7 +301,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(true)
.setDomain(DOMAIN_COMPLEXITY)
- .setFormula(AverageFormula.create(CoreMetrics.COMPLEXITY, CoreMetrics.FILES))
.create();
/**
@@ -326,7 +317,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
.setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildValuesFormula(false))
.setDeleteHistoricalData(true)
.create();
@@ -341,7 +331,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(true)
.setDomain(DOMAIN_COMPLEXITY)
- .setFormula(AverageFormula.create(CoreMetrics.COMPLEXITY_IN_CLASSES, CoreMetrics.CLASSES).setFallbackForMainMetric(CoreMetrics.COMPLEXITY))
.create();
/**
@@ -358,7 +347,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
.setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildValuesFormula(false))
.setDeleteHistoricalData(true)
.create();
@@ -373,7 +361,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(true)
.setDomain(DOMAIN_COMPLEXITY)
- .setFormula(AverageFormula.create(CoreMetrics.COMPLEXITY_IN_FUNCTIONS, CoreMetrics.FUNCTIONS).setFallbackForMainMetric(CoreMetrics.COMPLEXITY))
.create();
/**
@@ -403,7 +390,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_NONE)
.setQualitative(true)
.setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
.create();
public static final String FILE_COMPLEXITY_DISTRIBUTION_KEY = "file_complexity_distribution";
@@ -412,7 +398,6 @@ public final class CoreMetrics {
.setDirection(Metric.DIRECTION_NONE)
.setQualitative(true)
.setDomain(DOMAIN_COMPLEXITY)
- .setFormula(new SumChildDistributionFormula().setMinimumScopeToPersist(Scopes.DIRECTORY))
.create();
// --------------------------------------------------------------------------------------------------------------------
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 8e54fe1c7bc..9dad702c95f 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
@@ -650,7 +650,11 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
*
* @param f the formula
* @return the builder
+ *
+ * @deprecated since 5.2, it's no more possible to define a formula on a metric
+ * TODO add a link to the new API to declare formulas
*/
+ @Deprecated
public Builder setFormula(Formula f) {
this.formula = f;
return this;