if (context.repository(repository.getKey()) == null) { newRepository = context.createRepository(repository.getKey(), repository.getLanguage()); newRepository.setName(repository.getName()); } else { newRepository = context.extendRepository(repository.getKey(), repository.getLanguage()); for (org.sonar.api.rules.Rule rule : repository.createRules()) { RulesDefinition.NewRule newRule = newRepository.createRule(rule.getKey()); newRule.setName(ruleName(repository.getKey(), rule)); newRule.setHtmlDescription(ruleDescription(repository.getKey(), rule)); newRule.setInternalKey(rule.getConfigKey()); newRule.setTemplate(rule.isTemplate()); RulesDefinition.NewParam newParam = newRule.createParam(param.getKey()); newParam.setDefaultValue(param.getDefaultValue()); newParam.setDescription(paramDescription(repository.getKey(), rule.getKey(), param)); newParam.setType(RuleParamType.parse(param.getType())); updateRuleDebtDefinitions(newRule, repository.getKey(), rule.getKey(), ruleDebts);
if (context.repository(repository.getKey()) == null) { newRepository = context.createRepository(repository.getKey(), repository.getLanguage()); newRepository.setName(repository.getName()); } else { newRepository = context.extendRepository(repository.getKey(), repository.getLanguage()); for (org.sonar.api.rules.Rule rule : repository.createRules()) { RulesDefinition.NewRule newRule = newRepository.createRule(rule.getKey()); newRule.setName(ruleName(repository.getKey(), rule)); newRule.setHtmlDescription(ruleDescription(repository.getKey(), rule)); newRule.setInternalKey(rule.getConfigKey()); newRule.setTemplate(rule.isTemplate()); RulesDefinition.NewParam newParam = newRule.createParam(param.getKey()); newParam.setDefaultValue(param.getDefaultValue()); newParam.setDescription(paramDescription(repository.getKey(), rule.getKey(), param)); newParam.setType(RuleParamType.parse(param.getType())); updateRuleDebtDefinitions(newRule, repository.getKey(), rule.getKey(), ruleDebts);