Esempio n. 1
0
        public static bool MustRunInProcess(this DiagnosticAnalyzer analyzer)
        {
            if (analyzer.IsWorkspaceDiagnosticAnalyzer())
            {
                return(true);
            }

            var builtInAnalyzer = analyzer as IBuiltInAnalyzer;

            if (builtInAnalyzer == null)
            {
                return(false);
            }

            return(builtInAnalyzer.RunInProcess);
        }
Esempio n. 2
0
        public static bool ShouldRunForFullProject(this DiagnosticAnalyzerService service, DiagnosticAnalyzer analyzer, Project project)
        {
            var builtInAnalyzer = analyzer as IBuiltInAnalyzer;
            if (builtInAnalyzer != null)
            {
                return !builtInAnalyzer.OpenFileOnly(project.Solution.Workspace);
            }

            if (analyzer.IsWorkspaceDiagnosticAnalyzer())
            {
                return true;
            }

            // most of analyzers, number of descriptor is quite small, so this should be cheap.
            return service.GetDiagnosticDescriptors(analyzer).Any(d => d.GetEffectiveSeverity(project.CompilationOptions) != ReportDiagnostic.Hidden);
        }
Esempio n. 3
0
        public static bool ShouldRunForFullProject(this DiagnosticAnalyzerService service, DiagnosticAnalyzer analyzer, Project project)
        {
            var builtInAnalyzer = analyzer as IBuiltInAnalyzer;

            if (builtInAnalyzer != null)
            {
                return(!builtInAnalyzer.OpenFileOnly(project.Solution.Workspace));
            }

            if (analyzer.IsWorkspaceDiagnosticAnalyzer())
            {
                return(true);
            }

            // most of analyzers, number of descriptor is quite small, so this should be cheap.
            return(service.GetDiagnosticDescriptors(analyzer).Any(d => d.GetEffectiveSeverity(project.CompilationOptions) != ReportDiagnostic.Hidden));
        }
Esempio n. 4
0
 public static bool IsBuiltInAnalyzer(this DiagnosticAnalyzer analyzer)
 => analyzer is IBuiltInAnalyzer || analyzer.IsWorkspaceDiagnosticAnalyzer() || analyzer.IsCompilerAnalyzer();