Search in sources :

Example 6 with QualityProfile

use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile in project sonarqube by SonarSource.

the class QualityProfileProvider method provide.

public ModuleQProfiles provide(ProjectKey projectKey, QualityProfileLoader loader, ProjectRepositories projectRepositories, AnalysisProperties props) {
    if (this.profiles == null) {
        List<QualityProfile> profileList;
        Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
        if (!projectRepositories.exists()) {
            profileList = loader.loadDefault(getSonarProfile(props));
        } else {
            profileList = loader.load(projectKey.get(), getSonarProfile(props));
        }
        profiler.stopInfo();
        profiles = new ModuleQProfiles(profileList);
    }
    return profiles;
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) QualityProfile(org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile) ModuleQProfiles(org.sonar.scanner.rule.ModuleQProfiles)

Example 7 with QualityProfile

use of org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile in project sonarqube by SonarSource.

the class ActiveRulesProviderTest method mockProfiles.

private static ModuleQProfiles mockProfiles(String... keys) {
    List<QualityProfile> profiles = new LinkedList<>();
    for (String k : keys) {
        QualityProfile p = QualityProfile.newBuilder().setKey(k).setLanguage(k).build();
        profiles.add(p);
    }
    return new ModuleQProfiles(profiles);
}
Also used : QualityProfile(org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile) LinkedList(java.util.LinkedList) ModuleQProfiles(org.sonar.scanner.rule.ModuleQProfiles)

Aggregations

QualityProfile (org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile)7 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 Test (org.junit.Test)3 ModuleQProfiles (org.sonar.scanner.rule.ModuleQProfiles)2 SearchWsResponse (org.sonarqube.ws.QualityProfiles.SearchWsResponse)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 Profiler (org.sonar.api.utils.log.Profiler)1 ComponentDto (org.sonar.db.component.ComponentDto)1 OrganizationDto (org.sonar.db.organization.OrganizationDto)1 QualityProfileDto (org.sonar.db.qualityprofile.QualityProfileDto)1 QualityProfileTesting.newQualityProfileDto (org.sonar.db.qualityprofile.QualityProfileTesting.newQualityProfileDto)1 GetRequest (org.sonarqube.ws.client.GetRequest)1