diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-04-14 15:35:26 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-04-14 16:20:01 +0200 |
commit | 897b2d8df05c14640158d62b89c99dad478aa248 (patch) | |
tree | a27bdbea342b5fe151f778681f7d1c7fe431e666 /sonar-plugin-api | |
parent | 456a2311733cd6001fb9d8c75261a48b44ddc0e6 (diff) | |
download | sonarqube-897b2d8df05c14640158d62b89c99dad478aa248.tar.gz sonarqube-897b2d8df05c14640158d62b89c99dad478aa248.zip |
SONAR-5195 Revert preventing rule template to declare technical debt
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java | 3 | ||||
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java | 22 |
2 files changed, 0 insertions, 25 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java index ba5870588ca..831a05f1155 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java @@ -687,9 +687,6 @@ public interface RulesDefinition extends ServerExtension { if ((Strings.isNullOrEmpty(debtSubCharacteristic) && debtRemediationFunction != null) || (!Strings.isNullOrEmpty(debtSubCharacteristic) && debtRemediationFunction == null)) { throw new IllegalStateException(String.format("Both debt sub-characteristic and debt remediation function should be defined on rule '%s'", this)); } - if (!Strings.isNullOrEmpty(debtSubCharacteristic) && template) { - throw new IllegalStateException(String.format("'%s' is a rule template, it should not define technical debt.", this)); - } } @Override diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java index 43a88eaffe0..1027e8ba3fc 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java @@ -340,26 +340,4 @@ public class RulesDefinitionTest { } } - /** - * SONAR-5195 - */ - @Test - public void fail_if_rule_template_define_technical_debt() { - RulesDefinition.NewRepository newRepo = context.createRepository("squid", "java"); - RulesDefinition.NewRule newRule = newRepo.createRule("XPath rule") - .setTemplate(true) - .setName("Insufficient branch coverage") - .setHtmlDescription("This rule allows to define some homemade Java rules with help of an XPath expression.") - .setSeverity(Severity.MAJOR) - .setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.UNIT_TESTS); - newRule.setDebtRemediationFunction(newRule.debtRemediationFunctions().linearWithOffset("1h", "10min")); - - try { - newRepo.done(); - fail(); - } catch (IllegalStateException e) { - assertThat(e).hasMessage("'[repository=squid, key=XPath rule]' is a rule template, it should not define technical debt."); - } - } - } |