private IssuesSnapshot(Guid snapshotId, string projectName, Guid projectGuid, string filePath, IEnumerable <IAnalysisIssueVisualization> issues, IAnalysisSeverityToVsSeverityConverter toVsSeverityConverter, IRuleHelpLinkProvider ruleHelpLinkProvider) { var areAllIssuesAnalysisIssues = issues.All(x => x.Issue is IAnalysisIssue); if (!areAllIssuesAnalysisIssues) { throw new InvalidCastException($"Some {nameof(issues)} do not contain {nameof(IAnalysisIssue)}"); } this.AnalysisRunId = snapshotId; this.AnalyzedFilePath = filePath; this.projectName = projectName; this.projectGuid = projectGuid; this.versionNumber = GetNextVersionNumber(); this.toVsSeverityConverter = toVsSeverityConverter; this.ruleHelpLinkProvider = ruleHelpLinkProvider; this.issues = new List <IAnalysisIssueVisualization>(issues); this.readonlyIssues = new ReadOnlyCollection <IAnalysisIssueVisualization>(this.issues); // Optimistation: // Most rules only have a single location, and most multi-location rules only produce locations // for a single file. So most snapshots will only have issues relating to a single file. // However, we still need to notify every tagger when any snapshot has updated, in case there // any of the issues have secondary locations that the tagger needs to handle. // This optimisation gives the tagger a quick way to check that it does not need to do any work // i.e. if the file handled by the tagger is not in the list, do nothing. this.FilesInSnapshot = CalculateFilesInSnapshot(filePath, issues); }
internal SeverityToMonikerConverter(IAnalysisSeverityToVsSeverityConverter analysisSeverityToVsSeverityConverter) { this.analysisSeverityToVsSeverityConverter = analysisSeverityToVsSeverityConverter; }