aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-05-07 15:05:05 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-05-07 15:05:05 +0200
commit8f936044deed48e659bffaa9e6587fe22143a192 (patch)
tree1b055d6807c8323cbcd0dee50f29dc69fa0a60e7 /sonar-plugin-api/src
parent12077a645e769be0d4387f30a1e5f5c1966dc08e (diff)
downloadsonarqube-8f936044deed48e659bffaa9e6587fe22143a192.tar.gz
sonarqube-8f936044deed48e659bffaa9e6587fe22143a192.zip
SONAR-5130 Show distribution of LOC and TechDebt by language
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java15
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java6
2 files changed, 19 insertions, 2 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 852678a40af..1ac74b83a42 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
@@ -85,6 +85,21 @@ public final class CoreMetrics {
.setFormula(new SumChildValuesFormula(false))
.create();
+ /**
+ * @since 4.4
+ */
+ public static final String NCLOC_LANGUAGE_DISTRIBUTION_KEY = "ncloc_language_distribution";
+
+ /**
+ * @since 4.4
+ */
+ public static final Metric NCLOC_LANGUAGE_DISTRIBUTION = new Metric.Builder(NCLOC_LANGUAGE_DISTRIBUTION_KEY, "Lines of code per language", Metric.ValueType.DATA)
+ .setDescription("Non Commenting Lines of Code Distributed By Language")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .create();
+
public static final String GENERATED_NCLOC_KEY = "generated_ncloc";
public static final Metric GENERATED_NCLOC = new Metric.Builder(GENERATED_NCLOC_KEY, "Generated lines of code", Metric.ValueType.INT)
.setDescription("Generated non Commenting Lines of Code")
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java
index 1c65ebfb51f..086005be0f8 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java
@@ -28,10 +28,12 @@ import java.util.List;
import static org.fest.assertions.Assertions.assertThat;
public class CoreMetricsTest {
+
@Test
- public void shouldReadMetricsFromClassReflection() {
+ public void read_metrics_from_class_reflection() {
List<Metric> metrics = CoreMetrics.getMetrics();
- assertThat(metrics).hasSize(151);
+ assertThat(metrics).hasSize(152);
assertThat(metrics).contains(CoreMetrics.NCLOC, CoreMetrics.DIRECTORIES);
}
+
}