Search in sources :

Example 1 with BelongsToProfile

use of org.sonar.check.BelongsToProfile in project sonarqube by SonarSource.

the class AnnotationProfileParser method parse.

public RulesProfile parse(String repositoryKey, String profileName, String language, Collection<Class> annotatedClasses, ValidationMessages messages) {
    RulesProfile profile = RulesProfile.create(profileName, language);
    for (Class<?> aClass : annotatedClasses) {
        BelongsToProfile belongsToProfile = aClass.getAnnotation(BelongsToProfile.class);
        addRule(aClass, belongsToProfile, profile, repositoryKey, messages);
    }
    return profile;
}
Also used : BelongsToProfile(org.sonar.check.BelongsToProfile)

Example 2 with BelongsToProfile

use of org.sonar.check.BelongsToProfile in project sonarqube by SonarSource.

the class BuiltInQualityProfileAnnotationLoader method loadActiveRule.

void loadActiveRule(BuiltInQualityProfilesDefinition.NewBuiltInQualityProfile profile, String repositoryKey, Class<?> clazz) {
    BelongsToProfile belongsToProfile = clazz.getAnnotation(BelongsToProfile.class);
    if ((belongsToProfile != null) && StringUtils.equals(belongsToProfile.title(), profile.name())) {
        String ruleKey = RuleAnnotationUtils.getRuleKey(clazz);
        NewBuiltInActiveRule activeRule = profile.activateRule(repositoryKey, ruleKey);
        activeRule.overrideSeverity(belongsToProfile.priority().name());
    }
}
Also used : BelongsToProfile(org.sonar.check.BelongsToProfile) NewBuiltInActiveRule(org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.NewBuiltInActiveRule)

Aggregations

BelongsToProfile (org.sonar.check.BelongsToProfile)2 NewBuiltInActiveRule (org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.NewBuiltInActiveRule)1