]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4915 Do not display a warning when no effort to fix description with linear...
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 19 Mar 2014 13:22:24 +0000 (14:22 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 19 Mar 2014 13:22:24 +0000 (14:22 +0100)
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java

index 3c213f18b975f0ec235341342a4574c3b5a622eb..68b4d17d9ff00950b117cacd97a9ab1ed9bb5025 100644 (file)
@@ -23,7 +23,6 @@ import com.google.common.base.Strings;
 import com.google.common.collect.*;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.sonar.api.ServerExtension;
 import org.sonar.api.rule.RuleStatus;
@@ -50,8 +49,6 @@ import java.util.Set;
  */
 public interface RulesDefinition extends ServerExtension {
 
-  static final Logger LOG = LoggerFactory.getLogger(RulesDefinition.class);
-
   /**
    * Instantiated by core but not by plugins
    */
@@ -446,13 +443,6 @@ public interface RulesDefinition extends ServerExtension {
       if ((Strings.isNullOrEmpty(debtCharacteristic) && debtRemediationFunction != null) || (!Strings.isNullOrEmpty(debtCharacteristic) && debtRemediationFunction == null)) {
         throw new IllegalStateException(String.format("Both debt characteristic and debt remediation function should be defined on rule '%s'", this));
       }
-      if (debtRemediationFunction != null &&
-        (DebtRemediationFunction.Type.LINEAR.equals(debtRemediationFunction.type()) || DebtRemediationFunction.Type.LINEAR_OFFSET.equals(debtRemediationFunction.type())) &&
-        Strings.isNullOrEmpty(effortToFixDescription)) {
-        // Only generate a warning for the moment, but should throw an exception when most of plugin defines rules with Java API instead of XML
-        LOG.warn(String.format("'Rule '%s' should have a description for the remediation function parameter " +
-          "as it's using a 'Linear' or 'Linear with offset' remediation function ", this));
-      }
     }
 
     @Override
index a14051dfc4d86ff564a2af5fa0d5a96796a608eb..2cc13c0abc894de95376df6cbbb90bd53038ccc8 100644 (file)
@@ -321,24 +321,4 @@ public class RulesDefinitionTest {
     }
   }
 
-  @Test
-  public void not_fail_if_linear_but_no_effort_to_fix_description() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName("NPE").setHtmlDescription("Detect <code>java.lang.NullPointerException</code>")
-      .setDebtCharacteristic("COMPILER")
-      .setDebtRemediationFunction(DebtRemediationFunction.createLinear("1h"));
-    newRepository.done();
-    // A warning log is displayed
-  }
-
-  @Test
-  public void not_fail_if_linear_offset_but_no_effort_to_fix_description() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName("NPE").setHtmlDescription("Detect <code>java.lang.NullPointerException</code>")
-      .setDebtCharacteristic("COMPILER")
-      .setDebtRemediationFunction(DebtRemediationFunction.createLinearWithOffset("1h", "10min"));
-    newRepository.done();
-    // A warning log is displayed
-  }
-
 }