From 062c27d9de4d892209dc05087ae3dc68e0b93cb4 Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Fri, 12 Aug 2016 17:53:09 +0200 Subject: SONAR-7957 New metric « New Lines of Code » MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sonar/api/measures/CoreMetrics.java | 29 +++++++++++++++++++++- .../org/sonar/api/resources/CoreMetricsTest.java | 3 +-- 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'sonar-plugin-api') 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,12 +123,27 @@ public final class CoreMetrics { public static final String NCLOC_KEY = "ncloc"; public static final Metric 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 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 */ @@ -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 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 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 { -- cgit v1.2.3