From: Duarte Meneses Date: Wed, 30 Sep 2015 13:42:05 +0000 (+0200) Subject: Add rule's default parameters to active rules X-Git-Tag: 5.2-RC1~151 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a40d994889fae249ae7e60af71636ba45648181c;p=sonarqube.git Add rule's default parameters to active rules --- diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/DefaultActiveRulesLoader.java b/sonar-batch/src/main/java/org/sonar/batch/rule/DefaultActiveRulesLoader.java index 14c37bf1745..956793fe1a2 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/rule/DefaultActiveRulesLoader.java +++ b/sonar-batch/src/main/java/org/sonar/batch/rule/DefaultActiveRulesLoader.java @@ -102,7 +102,6 @@ public class DefaultActiveRulesLoader implements ActiveRulesLoader { Active active = activeList.getActiveList(0); LoadedActiveRule loadedRule = new LoadedActiveRule(); - Map params = new HashMap<>(); loadedRule.setRuleKey(RuleKey.parse(r.getKey())); loadedRule.setName(r.getName()); @@ -111,6 +110,13 @@ public class DefaultActiveRulesLoader implements ActiveRulesLoader { loadedRule.setInternalKey(r.getInternalKey()); loadedRule.setTemplateRuleKey(r.getTemplateKey()); + Map params = new HashMap<>(); + + for (org.sonarqube.ws.Rules.Rule.Param param : r.getParams().getParamsList()) { + params.put(param.getKey(), param.getDefaultValue()); + } + + // overrides defaultValue if the key is the same for (Param param : active.getParamsList()) { params.put(param.getKey(), param.getValue()); }