/// <summary> /// Runs the orchestrator. /// Posts new issues, ignoring duplicate comments and resolves comments that were open in an old iteration /// of the pull request. /// </summary> /// <returns>Information about the reported and written issues.</returns> public PrcaResult Run() { var format = PrcaCommentFormat.Undefined; // Initialize pull request system. this.log.Verbose("Initialize pull request system..."); var pullRequestSystemInitialized = this.pullRequestSystem.Initialize(this.settings); if (pullRequestSystemInitialized) { format = this.pullRequestSystem.GetPreferredCommentFormat(); this.log.Verbose("Pull request system prefers comments in {0} format.", format); } else { this.log.Warning("Error initializing the pull request system."); } var issueReader = new IssueReader(this.log, this.codeAnalysisProviders, this.settings); var issues = issueReader.ReadIssues(format).ToList(); // Don't process issues if pull request system could not be initialized. if (!pullRequestSystemInitialized) { return(new PrcaResult(issues, new List <ICodeAnalysisIssue>())); } this.log.Information("Processing {0} new issues", issues.Count); var postedIssues = this.PostAndResolveComments(this.settings, issues); return(new PrcaResult(issues, postedIssues)); }
public static IEnumerable <ICodeAnalysisIssue> ReadIssues( this ICakeContext context, IEnumerable <ICodeAnalysisProvider> issueProviders, ReadIssuesSettings settings) { context.NotNull(nameof(context)); settings.NotNull(nameof(settings)); // ReSharper disable once PossibleMultipleEnumeration issueProviders.NotNullOrEmptyOrEmptyElement(nameof(issueProviders)); // ReSharper disable once PossibleMultipleEnumeration var issueReader = new IssueReader(context.Log, issueProviders, settings); return(issueReader.ReadIssues(settings.Format)); }