/// <summary> /// Determines whether this analyzer will generate diagnostics of at least a minimum severity for any document within the project. /// </summary> public static async Task <bool> HasMinimumSeverityAsync( this DiagnosticAnalyzer analyzer, Project project, Compilation compilation, ReportDiagnostic minimumSeverity, CancellationToken cancellationToken) { if (compilation is null) { return(false); } foreach (var document in project.Documents) { // Is the document formattable? if (document.FilePath is null) { continue; } var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); if (analyzer.HasMinimumSeverity(document, project.AnalyzerOptions, options, minimumSeverity, compilation)) { return(true); } } return(false); }