From a40d994889fae249ae7e60af71636ba45648181c Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Wed, 30 Sep 2015 15:42:05 +0200 Subject: [PATCH] Add rule's default parameters to active rules --- .../org/sonar/batch/rule/DefaultActiveRulesLoader.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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()); } -- 2.39.5