use of org.sonarsource.sonarlint.core.container.model.DefaultRuleDetails in project sonarlint-core by SonarSource.
the class StorageRuleDetailsReader method apply.
@Override
public RuleDetails apply(String ruleKeyStr) {
Sonarlint.Rules rulesFromStorage = storageReader.readRules();
RuleKey ruleKey = RuleKey.parse(ruleKeyStr);
Sonarlint.Rules.Rule rule = rulesFromStorage.getRulesByKeyMap().get(ruleKeyStr);
if (rule == null) {
throw new IllegalArgumentException("Unable to find rule with key " + ruleKey);
}
String type = StringUtils.isEmpty(rule.getType()) ? null : rule.getType();
return new DefaultRuleDetails(ruleKeyStr, rule.getName(), rule.getHtmlDesc(), rule.getSeverity(), type, rule.getLang(), Collections.<String>emptySet(), rule.getHtmlNote());
}
use of org.sonarsource.sonarlint.core.container.model.DefaultRuleDetails in project sonarlint-core by SonarSource.
the class StandaloneGlobalContainer method getRuleDetails.
public RuleDetails getRuleDetails(String ruleKeyStr) {
RuleKey ruleKey = RuleKey.parse(ruleKeyStr);
DefaultRule rule = (DefaultRule) rules.find(ruleKey);
if (rule == null) {
throw new IllegalArgumentException("Unable to find rule with key " + ruleKey);
}
Repository repo = rulesDefinitions.repository(rule.key().repository());
return new DefaultRuleDetails(ruleKeyStr, rule.name(), rule.description(), rule.severity(), rule.type(), repo.language(), repo.rule(rule.key().rule()).tags(), "");
}
Aggregations