use of org.sonar.api.server.profile.BuiltInQualityProfilesDefinition in project sonarqube by SonarSource.
the class XooBuiltInQualityProfilesDefinitionTest method test_built_in_quality_profile.
@Test
public void test_built_in_quality_profile() {
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
underTest.define(context);
BuiltInQualityProfile profile = context.profile("xoo", "test BuiltInQualityProfilesDefinition");
assertThat(profile.isDefault()).isFalse();
assertThat(profile.name()).isEqualTo("test BuiltInQualityProfilesDefinition");
assertThat(profile.language()).isEqualTo("xoo");
assertThat(profile.rules()).hasSize(1);
BuiltInQualityProfilesDefinition.BuiltInActiveRule activeRule = profile.rule(RuleKey.of("xoo", "HasTag"));
assertThat(activeRule.overriddenSeverity()).isEqualTo("BLOCKER");
assertThat(activeRule.overriddenParams()).hasSize(1);
assertThat(activeRule.overriddenParam("tag").overriddenValue()).isEqualTo("TODO");
}
use of org.sonar.api.server.profile.BuiltInQualityProfilesDefinition in project sonarqube by SonarSource.
the class BuiltInQProfileRepositoryImpl method initialize.
@Override
public void initialize() {
checkState(qProfiles == null, "initialize must be called only once");
Profiler profiler = Profiler.create(LOGGER).startInfo("Load quality profiles");
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
for (BuiltInQualityProfilesDefinition definition : definitions) {
definition.define(context);
}
Map<String, Map<String, BuiltInQualityProfile>> rulesProfilesByLanguage = validateAndClean(context);
this.qProfiles = toFlatList(rulesProfilesByLanguage);
ensureAllLanguagesHaveAtLeastOneBuiltInQP();
profiler.stopDebug();
}
Aggregations