use of org.sonar.api.server.rule.RulesDefinition.Repository 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(), "");
}
use of org.sonar.api.server.rule.RulesDefinition.Repository in project sonarlint-core by SonarSource.
the class StandaloneActiveRulesProvider method createActiveRules.
private ActiveRules createActiveRules() {
ActiveRulesBuilder builder = new ActiveRulesBuilder();
ListMultimap<String, RulesProfile> profilesByLanguage = profilesByLanguage(profileDefinitions);
for (String language : profilesByLanguage.keySet()) {
List<RulesProfile> defs = profilesByLanguage.get(language);
registerProfilesForLanguage(builder, language, defs);
}
for (Repository repo : ruleDefsLoader.getContext().repositories()) {
for (Rule rule : repo.rules()) {
if (rule.activatedByDefault()) {
NewActiveRule newAr = builder.create(RuleKey.of(repo.key(), rule.key())).setLanguage(repo.language()).setName(rule.name()).setSeverity(rule.severity()).setInternalKey(rule.internalKey());
for (Param param : rule.params()) {
newAr.setParam(param.key(), param.defaultValue());
}
newAr.activate();
}
}
}
return builder.build();
}
Aggregations