From d45810b9a7742dc57f7a53e0e6b2349553e4c465 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Mon, 14 Mar 2011 16:45:31 +0100 Subject: [PATCH] Use Metric.Builder factory in CoreMetrics --- .../org/sonar/api/measures/CoreMetrics.java | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 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 5daca1d7e72..4cef9962936 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 @@ -258,8 +258,14 @@ public final class CoreMetrics { .create(); public static final String LINES_TO_COVER_KEY = "lines_to_cover"; - public static final Metric LINES_TO_COVER = new Metric(LINES_TO_COVER_KEY, "Lines to cover", "Lines to cover", Metric.ValueType.INT, - Metric.DIRECTION_BETTER, false, DOMAIN_TESTS).setFormula(new SumChildValuesFormula(false)).setHidden(true); + public static final Metric LINES_TO_COVER = new Metric.Builder(LINES_TO_COVER_KEY, "Lines to cover", Metric.ValueType.INT) + .setDescription("Lines to cover") + .setDirection(Metric.DIRECTION_BETTER) + .setQualitative(false) + .setDomain(DOMAIN_TESTS) + .setFormula(new SumChildValuesFormula(false)) + .setHidden(true) + .create(); public static final String NEW_LINES_TO_COVER_KEY = "new_lines_to_cover"; public static final Metric NEW_LINES_TO_COVER = new Metric.Builder(NEW_LINES_TO_COVER_KEY, "New lines to cover", Metric.ValueType.INT) @@ -403,12 +409,22 @@ public final class CoreMetrics { //-------------------------------------------------------------------------------------------------------------------- public static final String DUPLICATED_LINES_KEY = "duplicated_lines"; - public static final Metric DUPLICATED_LINES = new Metric(DUPLICATED_LINES_KEY, "Duplicated lines", "Duplicated lines", - Metric.ValueType.INT, Metric.DIRECTION_WORST, false, DOMAIN_DUPLICATION).setBestValue(0.0).setOptimizedBestValue(true); + public static final Metric DUPLICATED_LINES = new Metric.Builder(DUPLICATED_LINES_KEY, "Duplicated lines", Metric.ValueType.INT) + .setDescription("Duplicated lines") + .setDirection(Metric.DIRECTION_WORST) + .setDomain(DOMAIN_DUPLICATION) + .setBestValue(0.0) + .setOptimizedBestValue(true) + .create(); public static final String DUPLICATED_BLOCKS_KEY = "duplicated_blocks"; - public static final Metric DUPLICATED_BLOCKS = new Metric(DUPLICATED_BLOCKS_KEY, "Duplicated blocks", "Duplicated blocks", - Metric.ValueType.INT, Metric.DIRECTION_WORST, false, DOMAIN_DUPLICATION).setBestValue(0.0).setOptimizedBestValue(true); + public static final Metric DUPLICATED_BLOCKS = new Metric.Builder(DUPLICATED_BLOCKS_KEY, "Duplicated blocks", Metric.ValueType.INT) + .setDescription("Duplicated blocks") + .setDirection(Metric.DIRECTION_WORST) + .setDomain(DOMAIN_DUPLICATION) + .setBestValue(0.0) + .setOptimizedBestValue(true) + .create(); public static final String DUPLICATED_FILES_KEY = "duplicated_files"; public static final Metric DUPLICATED_FILES = new Metric(DUPLICATED_FILES_KEY, "Duplicated files", "Duplicated files", @@ -707,8 +723,10 @@ public final class CoreMetrics { public static final String PROFILE_KEY = "profile"; - public static final Metric PROFILE = new Metric(PROFILE_KEY, "Profile", "Selected quality profile", Metric.ValueType.DATA, - Metric.DIRECTION_NONE, false, DOMAIN_GENERAL); + public static final Metric PROFILE = new Metric.Builder(PROFILE_KEY, "Profile", Metric.ValueType.DATA) + .setDescription("Selected quality profile") + .setDomain(DOMAIN_GENERAL) + .create(); public static List metrics = Lists.newLinkedList(); -- 2.39.5