]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 Add check on effort to fix description on register rules
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 23 Jun 2014 09:01:10 +0000 (11:01 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 23 Jun 2014 09:01:10 +0000 (11:01 +0200)
plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooRulesDefinition.java
plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/XooRulesDefinitionTest.java
sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesMediumTest.java

index 0b4efbbc71738d05e8581521c8e039ff6fecb373..c58e3961afdf1c831cadf37cd61e9809b80d6ca2 100644 (file)
@@ -54,7 +54,8 @@ public class XooRulesDefinition implements RulesDefinition {
     // debt-related information
     x1Rule
       .setDebtSubCharacteristic(SubCharacteristics.INTEGRATION_TESTABILITY)
-      .setDebtRemediationFunction(x1Rule.debtRemediationFunctions().linearWithOffset("1h", "30min"));
+      .setDebtRemediationFunction(x1Rule.debtRemediationFunctions().linearWithOffset("1h", "30min"))
+      .setEffortToFixDescription("Effort to fix issue on one line");
 
     x1Rule.createParam("acceptWhitespace")
       .setDefaultValue("false")
index ec34d3bdcaa52bb2c1e3f5fa1f2e7e69f62326b4..cf96e6bf211ee01f3fd619ba380b040161a1f2a1 100644 (file)
@@ -48,5 +48,6 @@ public class XooRulesDefinitionTest {
     assertThat(x1.debtRemediationFunction().type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET);
     assertThat(x1.debtRemediationFunction().coefficient()).isEqualTo("1h");
     assertThat(x1.debtRemediationFunction().offset()).isEqualTo("30min");
+    assertThat(x1.effortToFixDescription()).isEqualTo("Effort to fix issue on one line");
   }
 }
index 60ae5716780f034de7937cc3adb83e41b7a5a3be..84bdaddd00b0f97ed42c5363bf8541f5cb85a6af 100644 (file)
@@ -109,6 +109,7 @@ public class RegisterRulesMediumTest {
     assertThat(rule.debtRemediationFunction().type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET);
     assertThat(rule.debtRemediationFunction().coefficient()).isEqualTo("1h");
     assertThat(rule.debtRemediationFunction().offset()).isEqualTo("30min");
+    assertThat(rule.effortToFixDescription()).isEqualTo("x1 effort to fix");
   }
 
   /**
@@ -171,6 +172,7 @@ public class RegisterRulesMediumTest {
     assertThat(rule.debtRemediationFunction().type()).isEqualTo(DebtRemediationFunction.Type.LINEAR);
     assertThat(rule.debtRemediationFunction().coefficient()).isEqualTo("2h");
     assertThat(rule.debtRemediationFunction().offset()).isNull();
+    assertThat(rule.effortToFixDescription()).isEqualTo("x1 effort to fix updated");
   }
 
   @Test
@@ -275,14 +277,14 @@ public class RegisterRulesMediumTest {
 
     // Add a user tag
     tester.get(RuleUpdater.class).update(RuleUpdate.createForPluginRule(rule.key())
-      .setTags(newHashSet("tag2")),
+      .setTags(newHashSet("user-tag")),
       UserSession.get());
     dbSession.clearCache();
 
     // Verify tags
     Rule ruleUpdated = index.getByKey(RuleTesting.XOO_X1);
     assertThat(ruleUpdated.systemTags()).contains("tag1");
-    assertThat(ruleUpdated.tags()).contains("tag2");
+    assertThat(ruleUpdated.tags()).contains("user-tag");
 
     // The plugin X1 will be updated
     rulesDefinition.includeX1 = false;
@@ -292,7 +294,7 @@ public class RegisterRulesMediumTest {
 
     // User tag should become a system tag
     Rule ruleReloaded = index.getByKey(RuleTesting.XOO_X1);
-    assertThat(ruleReloaded.systemTags()).contains("tag1", "tag2");
+    assertThat(ruleReloaded.systemTags()).contains("tag1", "tag2", "user-tag");
     assertThat(ruleUpdated.tags()).isEmpty();
   }
 
@@ -564,7 +566,7 @@ public class RegisterRulesMediumTest {
             .setHtmlDescription("x1 desc updated")
             .setSeverity(Severity.INFO)
             .setEffortToFixDescription("x1 effort to fix updated")
-            .setTags("tag1", "tag2");
+            .setTags("tag1", "tag2", "user-tag");
           x1Rule.createParam("acceptWhitespace")
             .setType(RuleParamType.BOOLEAN)
             .setDefaultValue("true")