Search in sources :

Example 1 with ProfileDefinition

use of org.sonar.api.profiles.ProfileDefinition in project sonarqube by SonarSource.

the class RegisterQualityProfiles method profilesByLanguage.

/**
   * @return profiles by language
   */
private ListMultimap<String, RulesProfile> profilesByLanguage() {
    ListMultimap<String, RulesProfile> byLang = ArrayListMultimap.create();
    for (ProfileDefinition definition : definitions) {
        ValidationMessages validation = ValidationMessages.create();
        RulesProfile profile = definition.createProfile(validation);
        validation.log(LOGGER);
        if (profile != null && !validation.hasErrors()) {
            byLang.put(StringUtils.lowerCase(profile.getLanguage()), profile);
        }
    }
    return byLang;
}
Also used : RulesProfile(org.sonar.api.profiles.RulesProfile) ProfileDefinition(org.sonar.api.profiles.ProfileDefinition) ValidationMessages(org.sonar.api.utils.ValidationMessages)

Example 2 with ProfileDefinition

use of org.sonar.api.profiles.ProfileDefinition in project sonarlint-core by SonarSource.

the class StandaloneActiveRulesProvider method profilesByLanguage.

private static ListMultimap<String, RulesProfile> profilesByLanguage(ProfileDefinition[] profileDefinitions) {
    ListMultimap<String, RulesProfile> byLang = ArrayListMultimap.create();
    for (ProfileDefinition definition : profileDefinitions) {
        ValidationMessages validation = ValidationMessages.create();
        RulesProfile profile = definition.createProfile(validation);
        if (profile != null && !validation.hasErrors()) {
            byLang.put(StringUtils.lowerCase(profile.getLanguage()), profile);
        }
    }
    return byLang;
}
Also used : RulesProfile(org.sonar.api.profiles.RulesProfile) ProfileDefinition(org.sonar.api.profiles.ProfileDefinition) ValidationMessages(org.sonar.api.utils.ValidationMessages)

Example 3 with ProfileDefinition

use of org.sonar.api.profiles.ProfileDefinition in project sonarqube by SonarSource.

the class QProfileReset method loadDefinitionsGroupedByName.

private ListMultimap<QProfileName, RulesProfile> loadDefinitionsGroupedByName(String language) {
    ListMultimap<QProfileName, RulesProfile> profilesByName = ArrayListMultimap.create();
    for (ProfileDefinition definition : definitions) {
        ValidationMessages validation = ValidationMessages.create();
        RulesProfile profile = definition.createProfile(validation);
        if (language.equals(profile.getLanguage())) {
            processValidationMessages(validation);
            profilesByName.put(new QProfileName(profile.getLanguage(), profile.getName()), profile);
        }
    }
    return profilesByName;
}
Also used : RulesProfile(org.sonar.api.profiles.RulesProfile) ProfileDefinition(org.sonar.api.profiles.ProfileDefinition) ValidationMessages(org.sonar.api.utils.ValidationMessages)

Aggregations

ProfileDefinition (org.sonar.api.profiles.ProfileDefinition)3 RulesProfile (org.sonar.api.profiles.RulesProfile)3 ValidationMessages (org.sonar.api.utils.ValidationMessages)3