private static void UpdateTeamBuildSummary(AnalysisConfig config, ProjectInfoAnalysisResult result, ILogger logger) { logger.LogMessage(Resources.Report_UpdatingTeamBuildSummary); int skippedProjectCount = GetProjectsByStatus(result, ProjectInfoValidity.NoFilesToAnalyze).Count(); int invalidProjectCount = GetProjectsByStatus(result, ProjectInfoValidity.InvalidGuid).Count(); invalidProjectCount += GetProjectsByStatus(result, ProjectInfoValidity.DuplicateGuid).Count(); int excludedProjectCount = GetProjectsByStatus(result, ProjectInfoValidity.ExcludeFlagSet).Count(); IEnumerable <ProjectInfo> validProjects = GetProjectsByStatus(result, ProjectInfoValidity.Valid); int productProjectCount = validProjects.Count(p => p.ProjectType == ProjectType.Product); int testProjectCount = validProjects.Count(p => p.ProjectType == ProjectType.Test); using (BuildSummaryLogger summaryLogger = new BuildSummaryLogger(config.GetTfsUri(), config.GetBuildUri())) { string projectDescription = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Report_SonarQubeProjectDescription, config.SonarProjectName, config.SonarProjectKey, config.SonarProjectVersion); // Add a link to SonarQube dashboard if analysis succeeded Debug.Assert(config.SonarRunnerPropertiesPath != null, "Not expecting the sonar-runner properties path to be null"); if (config.SonarRunnerPropertiesPath != null && result.RanToCompletion) { ISonarPropertyProvider propertyProvider = new FilePropertiesProvider(config.SonarRunnerPropertiesPath); string hostUrl = propertyProvider.GetProperty(SonarProperties.HostUrl).TrimEnd('/'); string sonarUrl = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}/dashboard/index/{1}", hostUrl, config.SonarProjectKey); summaryLogger.WriteMessage(Resources.Report_AnalysisSucceeded, projectDescription, sonarUrl); } if (!result.RanToCompletion) { summaryLogger.WriteMessage(Resources.Report_AnalysisFailed, projectDescription); } summaryLogger.WriteMessage(Resources.Report_ProductAndTestMessage, productProjectCount, testProjectCount); summaryLogger.WriteMessage(Resources.Report_InvalidSkippedAndExcludedMessage, invalidProjectCount, skippedProjectCount, excludedProjectCount); } }
private void UpdateLegacyTeamBuildSummary(SummaryReportData summaryData) { this.logger.LogInfo(Resources.Report_UpdatingTeamBuildSummary); using (BuildSummaryLogger summaryLogger = new BuildSummaryLogger(this.config.GetTfsUri(), this.config.GetBuildUri())) { // Add a link to SonarQube dashboard if analysis succeeded if (summaryData.Succeeded) { summaryLogger.WriteMessage(Resources.Report_AnalysisSucceeded, summaryData.ProjectDescription, summaryData.DashboardUrl); } else { summaryLogger.WriteMessage(Resources.Report_AnalysisFailed, summaryData.ProjectDescription); } summaryLogger.WriteMessage(Resources.Report_ProductAndTestMessage, summaryData.ProductProjects, summaryData.TestProjects); summaryLogger.WriteMessage(Resources.Report_InvalidSkippedAndExcludedMessage, summaryData.InvalidProjects, summaryData.SkippedProjects, summaryData.ExcludedProjects); } }