use of org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.BuiltInActiveRule in project sonarqube by SonarSource.
the class RegisterQualityProfilesNotificationTest method addPluginProfile.
private void addPluginProfile(RulesProfileDto dbProfile, RuleDefinitionDto... dbRules) {
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
NewBuiltInQualityProfile newQp = context.createBuiltInQualityProfile(dbProfile.getName(), dbProfile.getLanguage());
Arrays.stream(dbRules).forEach(dbRule -> newQp.activateRule(dbRule.getRepositoryKey(), dbRule.getRuleKey()).overrideSeverity(Severity.MAJOR));
newQp.done();
List<BuiltInActiveRule> rules = context.profile(dbProfile.getLanguage(), dbProfile.getName()).rules();
BuiltInQProfile.ActiveRule[] activeRules = toActiveRules(rules, dbRules);
builtInQProfileRepositoryRule.add(newLanguage(dbProfile.getLanguage()), dbProfile.getName(), false, activeRules);
}
Aggregations