コード例 #1
0
ファイル: TreatExport.cs プロジェクト: Cyrinehl/Portail
        // Fill for each profile: the attributes ProfileName, profileKey and the attributes buildName of profileBuilds
        public static void FillProfiles(SonarApiClient SonarClient, IConfigurationRoot configuration)
        {
            int NumberOfProfiles;

            Int32.TryParse(configuration["NumberProfiles"], out NumberOfProfiles);

            for (int number = 0; number < NumberOfProfiles; number++)
            {
                Profile           profile           = new Profile();
                SonarProjectsArgs SonarProjectsArgs = new SonarProjectsArgs();

                string ProfileKey  = "Profiles:" + number + ":Key";
                string ProfileName = "Profiles:" + number + ":ProfileName";

                profile.profileKey  = configuration[ProfileKey];
                profile.ProfileName = configuration[ProfileName];

                SonarProjectsArgs.ProfileKey = configuration[ProfileKey];
                SonarProjectsArgs.PageSize   = "400";
                SonarQualityProfileProjects SonarQualityProfileProjects = SonarClient.QualityProfiles.Projects(SonarProjectsArgs, configuration);


                foreach (SonarProjet project in SonarQualityProfileProjects.QualityProfileProjects)
                {
                    Build b = new Build();
                    b.buildName = project.Name;
                    profile.profileBuilds.Add(b);
                }

                profiles.Add(profile);
            }
        }
コード例 #2
0
ファイル: QualityProfiles.cs プロジェクト: Cyrinehl/Portail
        public SonarQualityProfileProjects Projects(SonarProjectsArgs SonarProjectsArgs, NameValueCollection configuration)
        {
            if (String.IsNullOrEmpty(SonarProjectsArgs.ProfileKey) &&
                (String.IsNullOrEmpty(SonarProjectsArgs.PageSize)))
            {
                throw new ArgumentException("Quality profile key And PageSize must be set.");
            }
            string url = string.Format("{0}api/qualityprofiles/projects{1}", SonarApiClient.BaseAddress, SonarProjectsArgs);

            return(SonarApiClient.QueryObject <SonarQualityProfileProjects>(url, configuration));
        }