]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7635 Sanitize metric name and description in default l10n bundle and CoreMetrics
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 13 May 2016 13:21:23 +0000 (15:21 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 18 May 2016 09:48:30 +0000 (11:48 +0200)
sonar-core/src/main/resources/org/sonar/l10n/core.properties
sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java
sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java

index 442e81d8f8356024cbcac6d4dd1a7b43eb57c6b0..fbe76868fa2562e0511c62bb08cc0be2ed290b91 100644 (file)
@@ -506,8 +506,7 @@ deletion.page=Deletion
 project_deletion.page=Delete {0}
 project_deletion.page.description=Delete this project from the SonarQube database.
 provisioning.page=Provisioning
-provisioning.page.description=Use this page to initialize projects if you would like to configure them before the first analysis. \
- Once a project is provisioned, you have access to perform all project configurations on it.
+provisioning.page.description=Use this page to initialize projects if you would like to configure them before the first analysis. Once a project is provisioned, you have access to perform all project configurations on it.
 
 #------------------------------------------------------------------------------
 #
@@ -2246,10 +2245,21 @@ metric.complexity.name=Complexity
 metric.complexity.description=Cyclomatic complexity
 metric.complexity.abbreviation=Cmpx
 
+metric.complexity_in_classes.name=Complexity in Classes
+metric.complexity_in_classes.description=Cyclomatic complexity in classes
+
+metric.complexity_in_functions.name=Complexity in Functions
+metric.complexity_in_functions.description=Cyclomatic complexity in functions
+
+metric.development_cost.name=SQALE Development Cost
+
 metric.directories.name=Directories
 metric.directories.description=Directories
 metric.directories.abbreviation=Dirs
 
+metric.effort_to_reach_maintainability_rating_a.name=Effort to Reach Maintainability Rating A
+metric.effort_to_reach_maintainability_rating_a.description=Effort to reach maintainability rating A
+
 metric.files.name=Files
 metric.files.description=Number of files
 
@@ -2266,17 +2276,31 @@ metric.generated_ncloc.name.suffix=generated lines of code
 metric.generated_ncloc.description=Generated non Commenting Lines of Code
 metric.generated_ncloc.abbreviation=Gen. LOC
 
+metric.last_commit_date.name=Date of Last Commit
+
 metric.lines.name=Lines
 metric.lines.description=Lines
 
+metric.new_reliability_remediation_effort.name=Reliability Remediation Effort on New Code
+metric.new_reliability_remediation_effort.description=Reliability remediation effort on new code
+
+metric.new_security_remediation_effort.name=Security Remediation Effort on New Code
+metric.new_security_remediation_effort.description=Security remediation effort on new code
+
 metric.ncloc.name=Lines of Code
 metric.ncloc.description=Non Commenting Lines of Code
 metric.ncloc.abbreviation=LOC
 
+metric.ncloc_language_distribution.name=Lines of Code Per Language
+metric.ncloc_language_distribution.description=Non Commenting Lines of Code Distributed By Language
+
 metric.packages.name=Packages
 metric.packages.description=Packages
 metric.packages.abbreviation=Pkgs
 
+metric.projects.name=Projects
+metric.projects.description=Number of projects
+
 metric.public_api.name=Public API
 metric.public_api.description=Public API
 
@@ -2288,6 +2312,18 @@ metric.public_undocumented_api.name=Public Undocumented API
 metric.public_undocumented_api.description=Public undocumented classes, functions and variables
 metric.public_undocumented_api.abbreviation=Pub. undoc. API
 
+metric.quality_gate_details.name=Quality Gate Details
+metric.quality_gate_details.description=The project detailed status with regard to its quality gate
+
+metric.quality_profiles.name=Profiles
+metric.quality_profiles.description=Details of quality profiles used during analysis
+
+metric.reliability_rating.description=Reliability rating
+metric.reliability_remediation_effort.description=Reliability Remediation Effort
+
+metric.security_rating.description=Security rating
+metric.security_remediation_effort.description=Security remediation effort
+
 metric.statements.name=Statements
 metric.statements.description=Number of statements
 metric.statements.abbreviation=Stmts
@@ -2732,16 +2768,10 @@ metric.profile_version.name=Profile Version
 metric.profile_version.description=Selected quality profile version
 
 
-#--------------------------------------------------------------------------------------------------------------------
-#
-# ISSUES METRICS
-#
-#--------------------------------------------------------------------------------------------------------------------
-
 metric.false_positive_issues.name=False Positive Issues
 metric.false_positive_issues.description=False positive issues
 
-metric.wont_fix_issues.name=Won't Fix  Issues
+metric.wont_fix_issues.name=Won't Fix Issues
 metric.wont_fix_issues.description=Won't fix issues
 
 metric.open_issues.name=Open Issues
@@ -2754,26 +2784,20 @@ metric.confirmed_issues.name=Confirmed Issues
 metric.confirmed_issues.description=Confirmed issues
 
 
-#--------------------------------------------------------------------------------------------------------------------
-#
-# TECHNICAL DEBT METRICS
-#
-#--------------------------------------------------------------------------------------------------------------------
-
 metric.sqale_index.name=Technical Debt
 metric.sqale_index.short_name=Effort
 metric.sqale_index.description=Total effort (in days) to fix all the issues on the component and therefore to comply to all the requirements.
 
 metric.new_technical_debt.name=Added Technical Debt
 metric.new_technical_debt.short_name=Added Debt
-metric.new_technical_debt.description=Added Technical Debt
+metric.new_technical_debt.description=Added technical debt
 
 metric.sqale_rating.name=Maintainability Rating
-metric.sqale_rating.description=A-to-E rating based on the technical debt ratio.
+metric.sqale_rating.description=A-to-E rating based on the technical debt ratio
 
 metric.sqale_debt_ratio.name=Technical Debt Ratio
 metric.sqale_debt_ratio.short_name=Debt Ratio
-metric.sqale_debt_ratio.description=Ratio of the actual technical debt compared to the estimated cost to develop the whole source code from scratch.
+metric.sqale_debt_ratio.description=Ratio of the actual technical debt compared to the estimated cost to develop the whole source code from scratch
 
 metric.new_sqale_debt_ratio.name=Technical Debt Ratio on New Code
 metric.new_sqale_debt_ratio.short_name=Debt Ratio on new code
index c1dfd378437bf740d65b8ca1f0e90c6e8e1a4e8b..b53d5e10e12dd4881c9c15576f4ef05872521249 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.core.i18n;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
@@ -28,6 +29,8 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.measures.Metric;
 import org.sonar.api.utils.DateUtils;
 import org.sonar.api.utils.System2;
 import org.sonar.core.platform.PluginInfo;
@@ -43,7 +46,7 @@ public class DefaultI18nTest {
   @Mock
   System2 system2;
 
-  DefaultI18n manager;
+  DefaultI18n underTest;
 
   @Before
   public void before() {
@@ -51,29 +54,57 @@ public class DefaultI18nTest {
     List<PluginInfo> plugins = Arrays.asList(newPlugin("sqale"), newPlugin("frpack"), newPlugin("checkstyle"), newPlugin("other"));
     when(pluginRepository.getPluginInfos()).thenReturn(plugins);
 
-    manager = new DefaultI18n(pluginRepository, system2);
-    manager.doStart(getClass().getClassLoader());
+    underTest = new DefaultI18n(pluginRepository, system2);
+    underTest.doStart(getClass().getClassLoader());
   }
 
   @Test
   public void load_core_bundle() {
-    assertThat(manager.message(Locale.ENGLISH, "any", null)).isEqualTo("Any");
+    assertThat(underTest.message(Locale.ENGLISH, "any", null)).isEqualTo("Any");
   }
 
   @Test
   public void introspect_all_available_properties() {
-    assertThat(manager.getPropertyKeys().contains("any")).isTrue();
+    assertThat(underTest.getPropertyKeys().contains("any")).isTrue();
     // Only in english
-    assertThat(manager.getPropertyKeys().contains("assignee")).isTrue();
-    assertThat(manager.getPropertyKeys().contains("sqale.page")).isTrue();
-    assertThat(manager.getPropertyKeys().contains("bla_bla_bla")).isFalse();
+    assertThat(underTest.getPropertyKeys().contains("assignee")).isTrue();
+    assertThat(underTest.getPropertyKeys().contains("sqale.page")).isTrue();
+    assertThat(underTest.getPropertyKeys().contains("bla_bla_bla")).isFalse();
+  }
+
+  @Test
+  public void all_core_metrics_are_in_core_bundle() {
+    List<Metric> coreMetrics = CoreMetrics.getMetrics();
+    List<String> incorrectMetricDefinitions = new ArrayList<>();
+    for (Metric metric : coreMetrics) {
+      if (metric.isHidden()) {
+        continue;
+      }
+      String metricNamePropertyKey = "metric." + metric.getKey() + ".name";
+      String l10nMetricName = underTest.message(Locale.ENGLISH, metricNamePropertyKey, null);
+      if (l10nMetricName == null) {
+        incorrectMetricDefinitions.add(metricNamePropertyKey + "=" + metric.getName());
+      } else if (!l10nMetricName.equals(metric.getName())) {
+        incorrectMetricDefinitions.add(metricNamePropertyKey + " is not consistent in core bundle and CoreMetrics");
+      }
+
+      String metricDescriptionPropertyKey = "metric." + metric.getKey() + ".description";
+      String l10nMetricDescription = underTest.message(Locale.ENGLISH, metricDescriptionPropertyKey, null);
+      if (l10nMetricDescription == null) {
+        incorrectMetricDefinitions.add(metricDescriptionPropertyKey + "=" + metric.getDescription());
+      } else if (!l10nMetricDescription.equals(metric.getDescription())) {
+        incorrectMetricDefinitions.add(metricDescriptionPropertyKey + " is not consistent in core bundle and CoreMetrics");
+      }
+    }
+
+    assertThat(incorrectMetricDefinitions).as("Metric definitions to fix in core bundle", incorrectMetricDefinitions.size()).isEmpty();
   }
 
   @Test
   public void get_english_labels() {
-    assertThat(manager.message(Locale.ENGLISH, "any", null)).isEqualTo("Any");
-    assertThat(manager.message(Locale.ENGLISH, "sqale.page", null)).isEqualTo("Sqale page title");
-    assertThat(manager.message(Locale.ENGLISH, "checkstyle.rule1.name", null)).isEqualTo("Rule one");
+    assertThat(underTest.message(Locale.ENGLISH, "any", null)).isEqualTo("Any");
+    assertThat(underTest.message(Locale.ENGLISH, "sqale.page", null)).isEqualTo("Sqale page title");
+    assertThat(underTest.message(Locale.ENGLISH, "checkstyle.rule1.name", null)).isEqualTo("Rule one");
   }
 
   // SONAR-2927
@@ -82,9 +113,9 @@ public class DefaultI18nTest {
     Locale defaultLocale = Locale.getDefault();
     try {
       Locale.setDefault(Locale.FRENCH);
-      assertThat(manager.message(Locale.ENGLISH, "any", null)).isEqualTo("Any");
-      assertThat(manager.message(Locale.ENGLISH, "sqale.page", null)).isEqualTo("Sqale page title");
-      assertThat(manager.message(Locale.ENGLISH, "checkstyle.rule1.name", null)).isEqualTo("Rule one");
+      assertThat(underTest.message(Locale.ENGLISH, "any", null)).isEqualTo("Any");
+      assertThat(underTest.message(Locale.ENGLISH, "sqale.page", null)).isEqualTo("Sqale page title");
+      assertThat(underTest.message(Locale.ENGLISH, "checkstyle.rule1.name", null)).isEqualTo("Rule one");
     } finally {
       Locale.setDefault(defaultLocale);
     }
@@ -92,80 +123,80 @@ public class DefaultI18nTest {
 
   @Test
   public void get_labels_from_french_pack() {
-    assertThat(manager.message(Locale.FRENCH, "checkstyle.rule1.name", null)).isEqualTo("Rule un");
-    assertThat(manager.message(Locale.FRENCH, "any", null)).isEqualTo("Tous");
+    assertThat(underTest.message(Locale.FRENCH, "checkstyle.rule1.name", null)).isEqualTo("Rule un");
+    assertThat(underTest.message(Locale.FRENCH, "any", null)).isEqualTo("Tous");
 
     // language pack
-    assertThat(manager.message(Locale.FRENCH, "sqale.page", null)).isEqualTo("Titre de la page Sqale");
+    assertThat(underTest.message(Locale.FRENCH, "sqale.page", null)).isEqualTo("Titre de la page Sqale");
   }
 
   @Test
   public void get_french_label_if_swiss_country() {
     Locale swiss = new Locale("fr", "CH");
-    assertThat(manager.message(swiss, "checkstyle.rule1.name", null)).isEqualTo("Rule un");
-    assertThat(manager.message(swiss, "any", null)).isEqualTo("Tous");
+    assertThat(underTest.message(swiss, "checkstyle.rule1.name", null)).isEqualTo("Rule un");
+    assertThat(underTest.message(swiss, "any", null)).isEqualTo("Tous");
 
     // language pack
-    assertThat(manager.message(swiss, "sqale.page", null)).isEqualTo("Titre de la page Sqale");
+    assertThat(underTest.message(swiss, "sqale.page", null)).isEqualTo("Titre de la page Sqale");
   }
 
   @Test
   public void fallback_to_default_locale() {
-    assertThat(manager.message(Locale.CHINA, "checkstyle.rule1.name", null)).isEqualTo("Rule one");
-    assertThat(manager.message(Locale.CHINA, "any", null)).isEqualTo("Any");
-    assertThat(manager.message(Locale.CHINA, "sqale.page", null)).isEqualTo("Sqale page title");
+    assertThat(underTest.message(Locale.CHINA, "checkstyle.rule1.name", null)).isEqualTo("Rule one");
+    assertThat(underTest.message(Locale.CHINA, "any", null)).isEqualTo("Any");
+    assertThat(underTest.message(Locale.CHINA, "sqale.page", null)).isEqualTo("Sqale page title");
   }
 
   @Test
   public void return_default_value_if_missing_key() {
-    assertThat(manager.message(Locale.ENGLISH, "bla_bla_bla", "default")).isEqualTo("default");
-    assertThat(manager.message(Locale.FRENCH, "bla_bla_bla", "default")).isEqualTo("default");
+    assertThat(underTest.message(Locale.ENGLISH, "bla_bla_bla", "default")).isEqualTo("default");
+    assertThat(underTest.message(Locale.FRENCH, "bla_bla_bla", "default")).isEqualTo("default");
   }
 
   @Test
   public void format_message_with_parameters() {
-    assertThat(manager.message(Locale.ENGLISH, "name_too_long_x", null, "10")).isEqualTo("Name is too long (maximum is 10 characters)");
+    assertThat(underTest.message(Locale.ENGLISH, "name_too_long_x", null, "10")).isEqualTo("Name is too long (maximum is 10 characters)");
   }
 
   @Test
   public void use_default_locale_if_missing_value_in_localized_bundle() {
-    assertThat(manager.message(Locale.FRENCH, "assignee", null)).isEqualTo("Assignee");
-    assertThat(manager.message(Locale.CHINA, "assignee", null)).isEqualTo("Assignee");
+    assertThat(underTest.message(Locale.FRENCH, "assignee", null)).isEqualTo("Assignee");
+    assertThat(underTest.message(Locale.CHINA, "assignee", null)).isEqualTo("Assignee");
   }
 
   @Test
   public void return_null_if_file_not_found() {
-    String html = manager.messageFromFile(Locale.ENGLISH, "UnknownRule.html", "checkstyle.rule1.name");
+    String html = underTest.messageFromFile(Locale.ENGLISH, "UnknownRule.html", "checkstyle.rule1.name");
     assertThat(html).isNull();
   }
 
   @Test
   public void return_null_if_rule_not_internationalized() {
-    String html = manager.messageFromFile(Locale.ENGLISH, "UnknownRule.html", "foo.rule1.name");
+    String html = underTest.messageFromFile(Locale.ENGLISH, "UnknownRule.html", "foo.rule1.name");
     assertThat(html).isNull();
   }
 
   @Test
   public void get_age_with_duration() {
-    assertThat(manager.age(Locale.ENGLISH, 10)).isEqualTo("less than a minute");
+    assertThat(underTest.age(Locale.ENGLISH, 10)).isEqualTo("less than a minute");
   }
 
   @Test
   public void get_age_with_dates() {
-    assertThat(manager.age(Locale.ENGLISH, DateUtils.parseDate("2014-01-01"), DateUtils.parseDate("2014-01-02"))).isEqualTo("a day");
+    assertThat(underTest.age(Locale.ENGLISH, DateUtils.parseDate("2014-01-01"), DateUtils.parseDate("2014-01-02"))).isEqualTo("a day");
   }
 
   @Test
   public void get_age_from_now() {
     when(system2.now()).thenReturn(DateUtils.parseDate("2014-01-02").getTime());
-    assertThat(manager.ageFromNow(Locale.ENGLISH, DateUtils.parseDate("2014-01-01"))).isEqualTo("a day");
+    assertThat(underTest.ageFromNow(Locale.ENGLISH, DateUtils.parseDate("2014-01-01"))).isEqualTo("a day");
   }
 
   @Test
   public void format_date_time() {
     TimeZone initialTz = TimeZone.getDefault();
     TimeZone.setDefault(TimeZone.getTimeZone("GMT+1"));
-    assertThat(manager.formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22T19:10:03+0100"))).startsWith("Jan 22, 2014");
+    assertThat(underTest.formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22T19:10:03+0100"))).startsWith("Jan 22, 2014");
     TimeZone.setDefault(initialTz);
   }
 
@@ -173,20 +204,20 @@ public class DefaultI18nTest {
   public void format_date() {
     TimeZone initialTz = TimeZone.getDefault();
     TimeZone.setDefault(TimeZone.getTimeZone("GMT+1"));
-    assertThat(manager.formatDate(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22T19:10:03+0100"))).isEqualTo("Jan 22, 2014");
+    assertThat(underTest.formatDate(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22T19:10:03+0100"))).isEqualTo("Jan 22, 2014");
     TimeZone.setDefault(initialTz);
   }
 
   @Test
   public void format_double() {
-    assertThat(manager.formatDouble(Locale.FRENCH, 10.56)).isEqualTo("10,6");
-    assertThat(manager.formatDouble(Locale.FRENCH, 10d)).isEqualTo("10,0");
+    assertThat(underTest.formatDouble(Locale.FRENCH, 10.56)).isEqualTo("10,6");
+    assertThat(underTest.formatDouble(Locale.FRENCH, 10d)).isEqualTo("10,0");
   }
 
   @Test
   public void format_integer() {
-    assertThat(manager.formatInteger(Locale.ENGLISH, 10)).isEqualTo("10");
-    assertThat(manager.formatInteger(Locale.ENGLISH, 100000)).isEqualTo("100,000");
+    assertThat(underTest.formatInteger(Locale.ENGLISH, 10)).isEqualTo("10");
+    assertThat(underTest.formatInteger(Locale.ENGLISH, 100000)).isEqualTo("100,000");
   }
 
   private PluginInfo newPlugin(String key) {
index dd975732b2895a0d15379c53bedf1ac710825fae..bb76445812ca89c9f9b8f15b24057bacc056c1b3 100644 (file)
@@ -410,7 +410,7 @@ public final class CoreMetrics {
    * @deprecated in 3.0 - see SONAR-3289
    */
   @Deprecated
-  public static final Metric<String> CLASS_COMPLEXITY_DISTRIBUTION = new Metric.Builder(CLASS_COMPLEXITY_DISTRIBUTION_KEY, "Classes Distribution / Complexity",
+  public static final Metric<String> CLASS_COMPLEXITY_DISTRIBUTION = new Metric.Builder(CLASS_COMPLEXITY_DISTRIBUTION_KEY, "Class Distribution / Complexity",
     Metric.ValueType.DISTRIB)
       .setDescription("Classes distribution /complexity")
       .setDirection(Metric.DIRECTION_NONE)
@@ -420,7 +420,7 @@ public final class CoreMetrics {
       .create();
 
   public static final String FUNCTION_COMPLEXITY_DISTRIBUTION_KEY = "function_complexity_distribution";
-  public static final Metric<String> FUNCTION_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FUNCTION_COMPLEXITY_DISTRIBUTION_KEY, "Functions Distribution / Complexity",
+  public static final Metric<String> FUNCTION_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FUNCTION_COMPLEXITY_DISTRIBUTION_KEY, "Function Distribution / Complexity",
     Metric.ValueType.DISTRIB)
       .setDescription("Functions distribution /complexity")
       .setDirection(Metric.DIRECTION_NONE)
@@ -429,7 +429,7 @@ public final class CoreMetrics {
       .create();
 
   public static final String FILE_COMPLEXITY_DISTRIBUTION_KEY = "file_complexity_distribution";
-  public static final Metric<String> FILE_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FILE_COMPLEXITY_DISTRIBUTION_KEY, "Files Distribution / Complexity",
+  public static final Metric<String> FILE_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FILE_COMPLEXITY_DISTRIBUTION_KEY, "File Distribution / Complexity",
     Metric.ValueType.DISTRIB)
       .setDescription("Files distribution /complexity")
       .setDirection(Metric.DIRECTION_NONE)
@@ -558,7 +558,7 @@ public final class CoreMetrics {
 
   public static final String NEW_LINES_TO_COVER_KEY = "new_lines_to_cover";
   public static final Metric<Integer> NEW_LINES_TO_COVER = new Metric.Builder(NEW_LINES_TO_COVER_KEY, "Lines to Cover on New Code", Metric.ValueType.INT)
-    .setDescription("Lines to cover on New Code")
+    .setDescription("Lines to cover on new code")
     .setDirection(Metric.DIRECTION_WORST)
     .setQualitative(false)
     .setDomain(DOMAIN_COVERAGE)
@@ -579,7 +579,7 @@ public final class CoreMetrics {
 
   public static final String NEW_UNCOVERED_LINES_KEY = "new_uncovered_lines";
   public static final Metric<Integer> NEW_UNCOVERED_LINES = new Metric.Builder(NEW_UNCOVERED_LINES_KEY, "Uncovered Lines on New Code", Metric.ValueType.INT)
-    .setDescription("Uncovered lines on New Code")
+    .setDescription("Uncovered lines on new code")
     .setDirection(Metric.DIRECTION_WORST)
     .setDomain(DOMAIN_COVERAGE)
     .setBestValue(0.0)
@@ -621,6 +621,7 @@ public final class CoreMetrics {
    */
   @Deprecated
   public static final Metric<String> COVERAGE_LINE_HITS_DATA = new Metric.Builder(COVERAGE_LINE_HITS_DATA_KEY, "Coverage Hits by Line", Metric.ValueType.DATA)
+    .setDescription("Coverage hits by line")
     .setDomain(DOMAIN_COVERAGE)
     .setDeleteHistoricalData(true)
     .create();
@@ -649,16 +650,16 @@ public final class CoreMetrics {
   /**
    * Use {@link CoverageMeasuresBuilder} to build measure for this metric.
    */
-  public static final Metric<Integer> UNCOVERED_CONDITIONS = new Metric.Builder(UNCOVERED_CONDITIONS_KEY, "Uncovered Branches", Metric.ValueType.INT)
-    .setDescription("Uncovered branches")
+  public static final Metric<Integer> UNCOVERED_CONDITIONS = new Metric.Builder(UNCOVERED_CONDITIONS_KEY, "Uncovered Conditions", Metric.ValueType.INT)
+    .setDescription("Uncovered conditions")
     .setDirection(Metric.DIRECTION_WORST)
     .setDomain(DOMAIN_COVERAGE)
     .setBestValue(0.0)
     .create();
 
   public static final String NEW_UNCOVERED_CONDITIONS_KEY = "new_uncovered_conditions";
-  public static final Metric<Integer> NEW_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_UNCOVERED_CONDITIONS_KEY, "Uncovered Branches on New Code", Metric.ValueType.INT)
-    .setDescription("Uncovered branches on New Code")
+  public static final Metric<Integer> NEW_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_UNCOVERED_CONDITIONS_KEY, "Uncovered Conditions on New Code", Metric.ValueType.INT)
+    .setDescription("Uncovered conditions on new code")
     .setDirection(Metric.DIRECTION_WORST)
     .setDomain(DOMAIN_COVERAGE)
     .setBestValue(0.0)
@@ -700,6 +701,7 @@ public final class CoreMetrics {
    */
   @Deprecated
   public static final Metric<String> CONDITIONS_BY_LINE = new Metric.Builder(CONDITIONS_BY_LINE_KEY, "Conditions by Line", Metric.ValueType.DATA)
+    .setDescription("Conditions by line")
     .setDomain(DOMAIN_COVERAGE)
     .setDeleteHistoricalData(true)
     .create();
@@ -718,6 +720,7 @@ public final class CoreMetrics {
    */
   @Deprecated
   public static final Metric<String> COVERED_CONDITIONS_BY_LINE = new Metric.Builder(COVERED_CONDITIONS_BY_LINE_KEY, "Covered Conditions by Line", Metric.ValueType.DATA)
+    .setDescription("Covered conditions by line")
     .setDomain(DOMAIN_COVERAGE)
     .setDeleteHistoricalData(true)
     .create();
@@ -736,8 +739,8 @@ public final class CoreMetrics {
   /**
    * @since 2.12
    */
-  public static final Metric<Double> IT_COVERAGE = new Metric.Builder(IT_COVERAGE_KEY, "IT coverage", Metric.ValueType.PERCENT)
-    .setDescription("Coverage by integration tests")
+  public static final Metric<Double> IT_COVERAGE = new Metric.Builder(IT_COVERAGE_KEY, "IT Coverage", Metric.ValueType.PERCENT)
+    .setDescription("Integration tests coverage")
     .setDirection(Metric.DIRECTION_BETTER)
     .setQualitative(true)
     .setDomain(DOMAIN_COVERAGE)
@@ -754,7 +757,7 @@ public final class CoreMetrics {
    * @since 2.12
    */
   public static final Metric<Double> NEW_IT_COVERAGE = new Metric.Builder(NEW_IT_COVERAGE_KEY, "Coverage by IT on New Code", Metric.ValueType.PERCENT)
-    .setDescription("Integration Tests Coverage of new/changed code")
+    .setDescription("Integration tests coverage of new/changed code")
     .setDirection(Metric.DIRECTION_BETTER)
     .setQualitative(true)
     .setDomain(DOMAIN_COVERAGE)
@@ -788,7 +791,7 @@ public final class CoreMetrics {
    * @since 2.12
    */
   public static final Metric<Integer> NEW_IT_LINES_TO_COVER = new Metric.Builder(NEW_IT_LINES_TO_COVER_KEY, "Lines to Cover by IT on New Code", Metric.ValueType.INT)
-    .setDescription("Lines to cover by Integration Tests on New Code")
+    .setDescription("Lines to cover on new code by integration tests")
     .setDirection(Metric.DIRECTION_WORST)
     .setQualitative(false)
     .setDomain(DOMAIN_COVERAGE)
@@ -804,7 +807,7 @@ public final class CoreMetrics {
    * @since 2.12
    */
   public static final Metric<Integer> IT_UNCOVERED_LINES = new Metric.Builder(IT_UNCOVERED_LINES_KEY, "IT Uncovered Lines", Metric.ValueType.INT)
-    .setDescription("IT uncovered lines")
+    .setDescription("Uncovered lines by integration tests")
     .setDirection(Metric.DIRECTION_WORST)
     .setQualitative(false)
     .setDomain(DOMAIN_COVERAGE)
@@ -819,7 +822,7 @@ public final class CoreMetrics {
    * @since 2.12
    */
   public static final Metric<Integer> NEW_IT_UNCOVERED_LINES = new Metric.Builder(NEW_IT_UNCOVERED_LINES_KEY, "Uncovered Lines by IT on New Code", Metric.ValueType.INT)
-    .setDescription("Uncovered lines by IT on New Code")
+    .setDescription("New lines that are not covered by integration tests")
     .setDirection(Metric.DIRECTION_WORST)
     .setDomain(DOMAIN_COVERAGE)
     .setBestValue(0.0)
@@ -835,7 +838,7 @@ public final class CoreMetrics {
    * @since 2.12
    */
   public static final Metric<Double> IT_LINE_COVERAGE = new Metric.Builder(IT_LINE_COVERAGE_KEY, "IT Line Coverage", Metric.ValueType.PERCENT)
-    .setDescription("IT line coverage")
+    .setDescription("Line coverage by integration tests")
     .setDirection(Metric.DIRECTION_BETTER)
     .setQualitative(true)
     .setDomain(DOMAIN_COVERAGE)
@@ -850,7 +853,7 @@ public final class CoreMetrics {
    * @since 2.12
    */
   public static final Metric<Double> NEW_IT_LINE_COVERAGE = new Metric.Builder(NEW_IT_LINE_COVERAGE_KEY, "Line Coverage by IT on New Code", Metric.ValueType.PERCENT)
-    .setDescription("Line Coverage by Integration Tests of added/changed code")
+    .setDescription("Integration tests line coverage of added/changed code")
     .setDirection(Metric.DIRECTION_BETTER)
     .setQualitative(true)
     .setWorstValue(0.0)
@@ -871,8 +874,8 @@ public final class CoreMetrics {
    * @deprecated since 5.2 soon to be removed
    */
   @Deprecated
-  public static final Metric<String> IT_COVERAGE_LINE_HITS_DATA = new Metric.Builder(IT_COVERAGE_LINE_HITS_DATA_KEY, "IT Coverage Hits Data", Metric.ValueType.DATA)
-    .setDescription("Integration Tests Code coverage line hits data")
+  public static final Metric<String> IT_COVERAGE_LINE_HITS_DATA = new Metric.Builder(IT_COVERAGE_LINE_HITS_DATA_KEY, "IT Coverage Hits by Line", Metric.ValueType.DATA)
+    .setDescription("Coverage hits by line by integration tests")
     .setDirection(Metric.DIRECTION_NONE)
     .setQualitative(false)
     .setDomain(DOMAIN_COVERAGE)
@@ -918,8 +921,8 @@ public final class CoreMetrics {
   /**
    * @since 2.12
    */
-  public static final Metric<Integer> IT_UNCOVERED_CONDITIONS = new Metric.Builder(IT_UNCOVERED_CONDITIONS_KEY, "IT Uncovered Branches", Metric.ValueType.INT)
-    .setDescription("Integration Tests uncovered conditions")
+  public static final Metric<Integer> IT_UNCOVERED_CONDITIONS = new Metric.Builder(IT_UNCOVERED_CONDITIONS_KEY, "IT Uncovered Conditions", Metric.ValueType.INT)
+    .setDescription("Uncovered conditions by integration tests")
     .setDirection(Metric.DIRECTION_WORST)
     .setDomain(DOMAIN_COVERAGE)
     .create();
@@ -932,9 +935,9 @@ public final class CoreMetrics {
   /**
    * @since 2.12
    */
-  public static final Metric<Integer> NEW_IT_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_IT_UNCOVERED_CONDITIONS_KEY, "Uncovered Branches by IT on New Code",
+  public static final Metric<Integer> NEW_IT_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_IT_UNCOVERED_CONDITIONS_KEY, "Uncovered Conditions by IT on New Code",
     Metric.ValueType.INT)
-      .setDescription("Uncovered branches by Integration Tests on New Code")
+      .setDescription("New conditions that are not covered by integration tests")
       .setDirection(Metric.DIRECTION_WORST)
       .setDomain(DOMAIN_COVERAGE)
       .setBestValue(0.0)
@@ -950,7 +953,7 @@ public final class CoreMetrics {
    * @since 2.12
    */
   public static final Metric<Double> IT_BRANCH_COVERAGE = new Metric.Builder(IT_BRANCH_COVERAGE_KEY, "IT Condition Coverage", Metric.ValueType.PERCENT)
-    .setDescription("IT condition coverage")
+    .setDescription("Condition coverage by integration tests")
     .setDirection(Metric.DIRECTION_BETTER)
     .setQualitative(true)
     .setDomain(DOMAIN_COVERAGE)
@@ -967,7 +970,7 @@ public final class CoreMetrics {
    * @since 2.12
    */
   public static final Metric<Double> NEW_IT_BRANCH_COVERAGE = new Metric.Builder(NEW_IT_BRANCH_COVERAGE_KEY, "Condition Coverage by IT on New Code", Metric.ValueType.PERCENT)
-    .setDescription("Condition coverage by Integration Tests of new/changed code")
+    .setDescription("Integration tests condition coverage of new/changed code")
     .setDirection(Metric.DIRECTION_BETTER)
     .setQualitative(true)
     .setDomain(DOMAIN_COVERAGE)
@@ -989,6 +992,7 @@ public final class CoreMetrics {
    */
   @Deprecated
   public static final Metric<String> IT_CONDITIONS_BY_LINE = new Metric.Builder(IT_CONDITIONS_BY_LINE_KEY, "IT Conditions by Line", Metric.ValueType.DATA)
+    .setDescription("IT conditions by line")
     .setDomain(DOMAIN_COVERAGE)
     .setDeleteHistoricalData(true)
     .create();
@@ -1006,6 +1010,7 @@ public final class CoreMetrics {
    */
   @Deprecated
   public static final Metric<String> IT_COVERED_CONDITIONS_BY_LINE = new Metric.Builder(IT_COVERED_CONDITIONS_BY_LINE_KEY, "IT Covered Conditions by Line", Metric.ValueType.DATA)
+    .setDescription("IT covered conditions by line")
     .setDomain(DOMAIN_COVERAGE)
     .setDeleteHistoricalData(true)
     .create();
@@ -1208,8 +1213,8 @@ public final class CoreMetrics {
   /**
    * @since 3.3
    */
-  public static final Metric<Integer> OVERALL_UNCOVERED_CONDITIONS = new Metric.Builder(OVERALL_UNCOVERED_CONDITIONS_KEY, "Overall Uncovered Branches", Metric.ValueType.INT)
-    .setDescription("Uncovered branches by all tests")
+  public static final Metric<Integer> OVERALL_UNCOVERED_CONDITIONS = new Metric.Builder(OVERALL_UNCOVERED_CONDITIONS_KEY, "Overall Uncovered Conditions", Metric.ValueType.INT)
+    .setDescription("Uncovered conditions by all tests")
     .setDirection(Metric.DIRECTION_WORST)
     .setDomain(DOMAIN_COVERAGE)
     .create();
@@ -1222,9 +1227,9 @@ public final class CoreMetrics {
   /**
    * @since 3.3
    */
-  public static final Metric<Integer> NEW_OVERALL_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_OVERALL_UNCOVERED_CONDITIONS_KEY, "Overall Uncovered Branches on New Code",
+  public static final Metric<Integer> NEW_OVERALL_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_OVERALL_UNCOVERED_CONDITIONS_KEY, "Overall Uncovered Conditions on New Code",
     Metric.ValueType.INT)
-      .setDescription("New branches that are not covered by any test")
+      .setDescription("New conditions that are not covered by any test")
       .setDirection(Metric.DIRECTION_WORST)
       .setDomain(DOMAIN_COVERAGE)
       .setBestValue(0.0)
@@ -1297,9 +1302,9 @@ public final class CoreMetrics {
    * @deprecated since 5.2 soon to be removed
    */
   @Deprecated
-  public static final Metric<String> OVERALL_COVERED_CONDITIONS_BY_LINE = new Metric.Builder(OVERALL_COVERED_CONDITIONS_BY_LINE_KEY, "Overall Covered Branches by Line",
+  public static final Metric<String> OVERALL_COVERED_CONDITIONS_BY_LINE = new Metric.Builder(OVERALL_COVERED_CONDITIONS_BY_LINE_KEY, "Overall Covered Conditions by Line",
     Metric.ValueType.DATA)
-      .setDescription("Overall covered branches by all tests and by line")
+      .setDescription("Overall covered conditions by all tests and by line")
       .setDomain(DOMAIN_COVERAGE)
       .setDeleteHistoricalData(true)
       .create();
@@ -1459,7 +1464,7 @@ public final class CoreMetrics {
 
   public static final String NEW_VIOLATIONS_KEY = "new_violations";
   public static final Metric<Integer> NEW_VIOLATIONS = new Metric.Builder(NEW_VIOLATIONS_KEY, "New Issues", Metric.ValueType.INT)
-    .setDescription("New Issues")
+    .setDescription("New issues")
     .setDirection(Metric.DIRECTION_WORST)
     .setQualitative(true)
     .setDomain(DOMAIN_ISSUES)
@@ -2206,6 +2211,7 @@ public final class CoreMetrics {
    */
   // TODO should be renamed to MAINTAINABILITY_REMEDIATION_EFFORT
   public static final Metric<Long> TECHNICAL_DEBT = new Metric.Builder(TECHNICAL_DEBT_KEY, "Technical Debt", Metric.ValueType.WORK_DUR)
+    .setDescription("Total effort (in days) to fix all the issues on the component and therefore to comply to all the requirements.")
     .setDomain(DOMAIN_MAINTAINABILITY)
     .setDirection(Metric.DIRECTION_WORST)
     .setOptimizedBestValue(true)
@@ -2223,8 +2229,8 @@ public final class CoreMetrics {
    * @since 4.1
    */
   // TODO should be renamed to NEW_MAINTAINABILITY_REMEDIATION_EFFORT
-  public static final Metric<Long> NEW_TECHNICAL_DEBT = new Metric.Builder(NEW_TECHNICAL_DEBT_KEY, "Technical Debt on New Code", Metric.ValueType.WORK_DUR)
-    .setDescription("Technical Debt of new code")
+  public static final Metric<Long> NEW_TECHNICAL_DEBT = new Metric.Builder(NEW_TECHNICAL_DEBT_KEY, "Added Technical Debt", Metric.ValueType.WORK_DUR)
+    .setDescription("Added technical debt")
     .setDomain(DOMAIN_MAINTAINABILITY)
     .setDirection(Metric.DIRECTION_WORST)
     .setOptimizedBestValue(true)
@@ -2244,6 +2250,7 @@ public final class CoreMetrics {
    */
   // TODO should be renamed to MAINTAINABILITY_RATING
   public static final Metric<Integer> SQALE_RATING = new Metric.Builder(SQALE_RATING_KEY, "Maintainability Rating", Metric.ValueType.RATING)
+    .setDescription("A-to-E rating based on the technical debt ratio")
     .setDomain(DOMAIN_MAINTAINABILITY)
     .setDirection(Metric.DIRECTION_WORST)
     .setQualitative(true)
@@ -2260,6 +2267,7 @@ public final class CoreMetrics {
    * @since 4.5
    */
   public static final Metric<String> DEVELOPMENT_COST = new Metric.Builder(DEVELOPMENT_COST_KEY, "SQALE Development Cost", Metric.ValueType.STRING)
+    .setDescription("SQALE development cost")
     .setDomain(DOMAIN_MAINTAINABILITY)
     .setDirection(Metric.DIRECTION_WORST)
     .setOptimizedBestValue(true)
@@ -2279,7 +2287,7 @@ public final class CoreMetrics {
    */
   // TODO should be renamed to TECHNICALDEBT_RATIO
   public static final Metric<Double> SQALE_DEBT_RATIO = new Metric.Builder(SQALE_DEBT_RATIO_KEY, "Technical Debt Ratio", Metric.ValueType.PERCENT)
-    .setDescription("Ratio of the technical debt compared to what it would cost to develop the whole source code from scratch.")
+    .setDescription("Ratio of the actual technical debt compared to the estimated cost to develop the whole source code from scratch")
     .setDomain(DOMAIN_MAINTAINABILITY)
     .setDirection(Metric.DIRECTION_WORST)
     .setOptimizedBestValue(true)
@@ -2316,6 +2324,7 @@ public final class CoreMetrics {
    */
   public static final Metric<Long> EFFORT_TO_REACH_MAINTAINABILITY_RATING_A = new Metric.Builder(EFFORT_TO_REACH_MAINTAINABILITY_RATING_A_KEY,
     "Effort to Reach Maintainability Rating A", Metric.ValueType.WORK_DUR)
+      .setDescription("Effort to reach maintainability rating A")
       .setDomain(DOMAIN_MAINTAINABILITY)
       .setDirection(Metric.DIRECTION_WORST)
       .setQualitative(true)
@@ -2339,6 +2348,7 @@ public final class CoreMetrics {
    */
   public static final Metric<Long> RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability Remediation Effort",
     Metric.ValueType.WORK_DUR)
+      .setDescription("Reliability Remediation Effort")
       .setDomain(DOMAIN_RELIABILITY)
       .setDirection(Metric.DIRECTION_WORST)
       .setOptimizedBestValue(true)
@@ -2356,6 +2366,7 @@ public final class CoreMetrics {
    */
   public static final Metric<Long> NEW_RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability Remediation Effort on New Code",
     Metric.ValueType.WORK_DUR)
+      .setDescription("Reliability remediation effort on new code")
       .setDomain(DOMAIN_RELIABILITY)
       .setDirection(Metric.DIRECTION_WORST)
       .setOptimizedBestValue(true)
@@ -2373,6 +2384,7 @@ public final class CoreMetrics {
    * @since 5.5
    */
   public static final Metric<Integer> RELIABILITY_RATING = new Metric.Builder(RELIABILITY_RATING_KEY, "Reliability Rating", Metric.ValueType.RATING)
+    .setDescription("Reliability rating")
     .setDomain(DOMAIN_RELIABILITY)
     .setDirection(Metric.DIRECTION_WORST)
     .setQualitative(true)
@@ -2395,6 +2407,7 @@ public final class CoreMetrics {
    * @since 5.5
    */
   public static final Metric<Long> SECURITY_REMEDIATION_EFFORT = new Metric.Builder(SECURITY_REMEDIATION_EFFORT_KEY, "Security Remediation Effort", Metric.ValueType.WORK_DUR)
+    .setDescription("Security remediation effort")
     .setDomain(DOMAIN_SECURITY)
     .setDirection(Metric.DIRECTION_WORST)
     .setOptimizedBestValue(true)
@@ -2412,6 +2425,7 @@ public final class CoreMetrics {
    */
   public static final Metric<Long> NEW_SECURITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_SECURITY_REMEDIATION_EFFORT_KEY, "Security Remediation Effort on New Code",
     Metric.ValueType.WORK_DUR)
+    .setDescription("Security remediation effort on new code")
       .setDomain(DOMAIN_SECURITY)
       .setDirection(Metric.DIRECTION_WORST)
       .setOptimizedBestValue(true)
@@ -2429,6 +2443,7 @@ public final class CoreMetrics {
    * @since 5.5
    */
   public static final Metric<Integer> SECURITY_RATING = new Metric.Builder(SECURITY_RATING_KEY, "Security Rating", Metric.ValueType.RATING)
+    .setDescription("Security rating")
     .setDomain(DOMAIN_SECURITY)
     .setDirection(Metric.DIRECTION_WORST)
     .setQualitative(true)
@@ -2520,7 +2535,7 @@ public final class CoreMetrics {
    * @since 4.4
    */
   public static final Metric<String> QUALITY_GATE_DETAILS = new Metric.Builder(QUALITY_GATE_DETAILS_KEY, "Quality Gate Details", Metric.ValueType.DATA)
-    .setDescription("The project detailed status with regard to its quality gate.")
+    .setDescription("The project detailed status with regard to its quality gate")
     .setDomain(DOMAIN_GENERAL)
     .create();
 
index df5f3144f1a3d3d6c1498b6e432e8f5ed126842c..e82d793431a4a51765a59c8a535ff24819e6646a 100644 (file)
@@ -35,5 +35,4 @@ public class CoreMetricsTest {
     assertThat(metrics.size()).isGreaterThan(100);
     assertThat(metrics).contains(CoreMetrics.NCLOC, CoreMetrics.DIRECTORIES);
   }
-
 }