]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5094 Create Quality Gate Status metric
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Thu, 6 Mar 2014 14:34:37 +0000 (15:34 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 7 Mar 2014 07:42:46 +0000 (08:42 +0100)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
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 15d05d37653a9dd2b9f5100e77892a36bd72393d..127303eec2d295d23095f29cea9e2ed0dca2b755 100644 (file)
@@ -1956,6 +1956,10 @@ metric.alert_status.name=Alert
 metric.alert_status.description=Alert
 metric.alert_status.abbreviation=A
 
+metric.quality_gate_status.name=Quality Gate Status
+metric.quality_gate_status.description=The project status with regard to it's quality thresholds.
+metric.quality_gate_status.abbreviation=QG
+
 metric.classes.name=Classes
 metric.classes.description=Classes
 
index 6c2d95c5413c0efe704fa2c34193015e1fe042f8..9ab27ebde59f006f85ff7faef9ca89a381375d4e 100644 (file)
@@ -32,10 +32,6 @@ import java.util.List;
  */
 public final class CoreMetrics {
 
-  private CoreMetrics() {
-    // only static stuff
-  }
-
   // the following fields are not final to avoid compile-time constants used by plugins
   public static String DOMAIN_SIZE = "Size";
   public static String DOMAIN_TESTS = "Tests";
@@ -2214,6 +2210,14 @@ public final class CoreMetrics {
     .setDomain(DOMAIN_GENERAL)
     .create();
 
+  public static final String QUALITY_GATE_STATUS_KEY = "quality_gate_status";
+  public static final Metric QUALITY_GATE_STATUS = new Metric.Builder(QUALITY_GATE_STATUS_KEY, "Quality Gate Status", Metric.ValueType.LEVEL)
+    .setDescription("The project status with regard to it's quality thresholds.")
+    .setDirection(Metric.DIRECTION_BETTER)
+    .setQualitative(true)
+    .setDomain(DOMAIN_GENERAL)
+    .create();
+
   public static final String PROFILE_KEY = "profile";
   public static final Metric PROFILE = new Metric.Builder(PROFILE_KEY, "Profile", Metric.ValueType.DATA)
     .setDescription("Selected quality profile")
@@ -2251,6 +2255,10 @@ public final class CoreMetrics {
     }
   }
 
+  private CoreMetrics() {
+    // only static stuff
+  }
+
   public static List<Metric> getMetrics() {
     return METRICS;
   }
index ac33cd953dd3977001f7c5a9e632a6d9022aee27..dc05cca8d630ce71723dafb46a5ce714cc35431e 100644 (file)
@@ -31,7 +31,7 @@ public class CoreMetricsTest {
   @Test
   public void shouldReadMetricsFromClassReflection() {
     List<Metric> metrics = CoreMetrics.getMetrics();
-    assertThat(metrics).hasSize(150);
+    assertThat(metrics).hasSize(151);
     assertThat(metrics).contains(CoreMetrics.NCLOC, CoreMetrics.DIRECTORIES);
   }
 }