aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-08-12 17:53:09 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-08-13 12:08:39 +0200
commit062c27d9de4d892209dc05087ae3dc68e0b93cb4 (patch)
tree2308a470793f52c326d275bbbb2a955c068702db /sonar-plugin-api
parented92f9d0d05ea12d91176dcbe8c63a8f7eb685e6 (diff)
downloadsonarqube-062c27d9de4d892209dc05087ae3dc68e0b93cb4.tar.gz
sonarqube-062c27d9de4d892209dc05087ae3dc68e0b93cb4.zip
SONAR-7957 New metric « New Lines of Code »
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java29
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java3
2 files changed, 29 insertions, 3 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 a576efb7530..58bce43ac4b 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
@@ -123,13 +123,28 @@ public final class CoreMetrics {
public static final String NCLOC_KEY = "ncloc";
public static final Metric<Integer> NCLOC = new Metric.Builder(NCLOC_KEY, "Lines of Code", Metric.ValueType.INT)
- .setDescription("Non Commenting Lines of Code")
+ .setDescription("Non commenting lines of code")
.setDirection(Metric.DIRECTION_WORST)
.setQualitative(false)
.setDomain(DOMAIN_SIZE)
.create();
/**
+ * @since 6.1
+ */
+ public static final String NEW_NCLOC_KEY = "new_ncloc";
+ /**
+ * @since 6.1
+ */
+ public static final Metric<Integer> NEW_NCLOC = new Metric.Builder(NEW_NCLOC_KEY, "New Lines of Code", Metric.ValueType.INT)
+ .setDescription("New non commenting lines of code")
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
+ .setDomain(DOMAIN_SIZE)
+ .setDeleteHistoricalData(true)
+ .create();
+
+ /**
* @since 4.4
*/
public static final String NCLOC_LANGUAGE_DISTRIBUTION_KEY = "ncloc_language_distribution";
@@ -1314,7 +1329,13 @@ public final class CoreMetrics {
.setOptimizedBestValue(true)
.create();
+ /**
+ * @since 6.1
+ */
public static final String NEW_LINES_DUPLICATED_KEY = "new_duplicated_lines";
+ /**
+ * @since 6.1
+ */
public static final Metric<Integer> NEW_LINES_DUPLICATED = new Metric.Builder(NEW_LINES_DUPLICATED_KEY, "New Duplicated Lines", Metric.ValueType.INT)
.setDescription("New duplicated lines")
.setDirection(Metric.DIRECTION_WORST)
@@ -1334,7 +1355,13 @@ public final class CoreMetrics {
.setOptimizedBestValue(true)
.create();
+ /**
+ * @since 6.1
+ */
public static final String NEW_BLOCKS_DUPLICATED_KEY = "new_duplicated_blocks";
+ /**
+ * @since 6.1
+ */
public static final Metric<Integer> NEW_BLOCKS_DUPLICATED = new Metric.Builder(NEW_BLOCKS_DUPLICATED_KEY, "Duplicated Blocks on New Code", Metric.ValueType.INT)
.setDescription("Duplicated blocks on new code")
.setDirection(Metric.DIRECTION_WORST)
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 e82d793431a..854cef24431 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
@@ -19,12 +19,11 @@
*/
package org.sonar.api.resources;
+import java.util.List;
import org.junit.Test;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Metric;
-import java.util.List;
-
import static org.assertj.core.api.Assertions.assertThat;
public class CoreMetricsTest {