use of org.sonar.api.batch.rule.internal.NewRule in project sonarqube by SonarSource.
the class RulesProvider method load.
private static Rules load(RulesLoader ref) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
List<Rule> loadedRules = ref.load();
RulesBuilder builder = new RulesBuilder();
for (Rule r : loadedRules) {
NewRule newRule = builder.add(RuleKey.of(r.getRepository(), r.getKey()));
newRule.setName(r.getName());
newRule.setInternalKey(r.getInternalKey());
}
profiler.stopInfo();
return builder.build();
}
use of org.sonar.api.batch.rule.internal.NewRule in project sonarlint-core by SonarSource.
the class SonarQubeRulesProvider method provide.
public Rules provide(Sonarlint.Rules storageRules) {
if (rules == null) {
RulesBuilder builder = new RulesBuilder();
for (Map.Entry<String, Sonarlint.Rules.Rule> entry : storageRules.getRulesByKeyMap().entrySet()) {
Sonarlint.Rules.Rule r = entry.getValue();
NewRule newRule = builder.add(RuleKey.of(r.getRepo(), r.getKey())).setName(r.getName()).setInternalKey(r.getInternalKey()).setSeverity(r.getSeverity()).setDescription(r.getHtmlDesc());
if (StringUtils.isNotEmpty(r.getType())) {
newRule.setType(r.getType());
}
}
rules = builder.build();
}
return rules;
}
Aggregations