From f40734cb512ab21804516ded9baae568e10df688 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 5 Dec 2012 10:31:59 +0100 Subject: [PATCH] Fix some quality flaws --- .../org/sonar/plugins/core/web/TestsViewer.java | 11 +++++++++-- .../src/main/java/org/sonar/api/profiles/Alert.java | 13 +++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/TestsViewer.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/TestsViewer.java index eee72b05346..c2d6efbc06d 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/TestsViewer.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/TestsViewer.java @@ -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 { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/Alert.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/Alert.java index 1afbaef3426..c7be830d8dd 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/Alert.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/Alert.java @@ -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()); -- 2.39.5