private bool IsCandidateForFullSolutionAnalysis(DiagnosticAnalyzer analyzer, Project project, ImmutableDictionary <string, ReportDiagnostic> analyzerConfigSpecialDiagnosticOptions) { // PERF: Don't query descriptors for compiler analyzer or file content load analyzer, always execute them. if (analyzer == FileContentLoadAnalyzer.Instance || analyzer.IsCompilerAnalyzer()) { return(true); } if (analyzer.IsBuiltInAnalyzer()) { // always return true for builtin analyzer. we can't use // descriptor check since many builtin analyzer always return // hidden descriptor regardless what descriptor it actually // return on runtime. they do this so that they can control // severity through option page rather than rule set editor. // this is special behavior only ide analyzer can do. we hope // once we support editorconfig fully, third party can use this // ability as well and we can remove this kind special treatment on builtin // analyzer. return(true); } if (analyzer is DiagnosticSuppressor) { // Always execute diagnostic suppressors. return(true); } // For most of analyzers, the number of diagnostic descriptors is small, so this should be cheap. var descriptors = DiagnosticAnalyzerInfoCache.GetDiagnosticDescriptors(analyzer); return(descriptors.Any(d => d.GetEffectiveSeverity(project.CompilationOptions !, analyzerConfigSpecialDiagnosticOptions) != ReportDiagnostic.Hidden)); }
private bool IsCandidateForFullSolutionAnalysis(DiagnosticAnalyzer analyzer, Project project) { // PERF: Don't query descriptors for compiler analyzer, always execute it. if (HostAnalyzerManager.IsCompilerDiagnosticAnalyzer(project.Language, analyzer)) { return(true); } if (analyzer.IsBuiltInAnalyzer()) { // always return true for builtin analyzer. we can't use // descriptor check since many builtin analyzer always return // hidden descriptor regardless what descriptor it actually // return on runtime. they do this so that they can control // severity through option page rather than rule set editor. // this is special behavior only ide analyzer can do. we hope // once we support editorconfig fully, third party can use this // ability as well and we can remove this kind special treatment on builtin // analyzer. return(true); } return(Owner.HasNonHiddenDescriptor(analyzer, project)); }
private bool IsCandidateForFullSolutionAnalysis(DiagnosticAnalyzer analyzer, Project project) { // PERF: Don't query descriptors for compiler analyzer, always execute it. if (HostAnalyzerManager.IsCompilerDiagnosticAnalyzer(project.Language, analyzer)) { return true; } if (analyzer.IsBuiltInAnalyzer()) { // always return true for builtin analyzer. we can't use // descriptor check since many builtin analyzer always return // hidden descriptor regardless what descriptor it actually // return on runtime. they do this so that they can control // severity through option page rather than rule set editor. // this is special behavior only ide analyzer can do. we hope // once we support editorconfig fully, third party can use this // ability as well and we can remove this kind special treatment on builtin // analyzer. return true; } return Owner.HasNonHiddenDescriptor(analyzer, project); }