]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorJulien Lancelot <julien.lancelot@gmail.com>
Wed, 5 Dec 2012 09:31:59 +0000 (10:31 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Wed, 5 Dec 2012 09:31:59 +0000 (10:31 +0100)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/TestsViewer.java
sonar-plugin-api/src/main/java/org/sonar/api/profiles/Alert.java

index eee72b053462415076cbeedf6206f8fdd724b95f..c2d6efbc06db47dafd419f0b8d19c2101e962392 100644 (file)
@@ -21,11 +21,18 @@ package org.sonar.plugins.core.web;
 
 import org.sonar.api.measures.CoreMetrics;
 import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.web.*;
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.DefaultTab;
+import org.sonar.api.web.NavigationSection;
+import org.sonar.api.web.ResourceQualifier;
+import org.sonar.api.web.RubyRailsPage;
+import org.sonar.api.web.UserRole;
 
 @ResourceQualifier(Qualifiers.UNIT_TEST_FILE)
 @NavigationSection(NavigationSection.RESOURCE_TAB)
-@DefaultTab(metrics = {CoreMetrics.TESTS_KEY, CoreMetrics.TEST_EXECUTION_TIME_KEY, CoreMetrics.TEST_SUCCESS_DENSITY_KEY, CoreMetrics.TEST_FAILURES_KEY, CoreMetrics.TEST_ERRORS_KEY, CoreMetrics.SKIPPED_TESTS_KEY})
+@DefaultTab(metrics = {
+    CoreMetrics.TESTS_KEY, CoreMetrics.TEST_EXECUTION_TIME_KEY, CoreMetrics.TEST_SUCCESS_DENSITY_KEY,
+    CoreMetrics.TEST_FAILURES_KEY, CoreMetrics.TEST_ERRORS_KEY, CoreMetrics.SKIPPED_TESTS_KEY})
 @UserRole(UserRole.CODEVIEWER)
 public class TestsViewer extends AbstractRubyTemplate implements RubyRailsPage {
 
index 1afbaef3426dbe37a913956e2e8d5371bcb79d94..c7be830d8ddd73a9f1e7395b1bc5f3f2975a5706 100644 (file)
@@ -230,6 +230,19 @@ public class Alert extends BaseIdentifiable implements Cloneable {
     return operator.equals(OPERATOR_NOT_EQUALS);
   }
 
+  /**
+   * This method should not be used because it does not manage alerts with variation
+   * @see org.sonar.plugins.core.sensors.CheckAlertThresholds#getAlertLabel(Alert alert, Metric.Level level)
+   * @deprecated
+   */
+  public String getAlertLabel(Metric.Level level) {
+    return new StringBuilder()
+        .append(getMetric().getName())
+        .append(" ").append(getOperator())
+        .append(" ")
+        .append(level.equals(Metric.Level.ERROR) ? getValueError() : getValueWarning()).toString();
+  }
+
   @Override
   public Object clone() {
     return new Alert(getRulesProfile(), getMetric(), getOperator(), getValueError(), getValueWarning(), getPeriod());