private void RegisterAnalyzers(CompilationAnalysisContext context)
 {
     foreach (SyntaxNode method in this.orchestratorMethodDeclarations)
     {
         DateTimeAnalyzer.RegisterDiagnostic(method, context, this.semanticModel);
         EnvironmentVariableAnalyzer.RegisterDiagnostic(method, context, this.semanticModel);
         GuidAnalyzer.RegisterDiagnostic(method, context, this.semanticModel);
         IOTypesAnalyzer.RegisterDiagnostic(method, context, this.semanticModel);
         ThreadTaskAnalyzer.RegisterDiagnostic(method, context, this.semanticModel);
         TimerAnalyzer.RegisterDiagnostic(method, context, this.semanticModel);
         MethodAnalyzer.RegisterDiagnostics(method, context, this.semanticModel);
     }
 }
        private static List <MethodInformation> RegisterAnalyzers(List <MethodInformation> methodInformationList, CompilationAnalysisContext context, SemanticModel semanticModel)
        {
            foreach (MethodInformation method in methodInformationList)
            {
                var declaration = method.Declaration;

                // | is the non short circuit or; this is important so that each method analyzes the code and reports all needed diagnostics.
                if (DateTimeAnalyzer.RegisterDiagnostic(declaration, context, semanticModel) |
                    EnvironmentVariableAnalyzer.RegisterDiagnostic(declaration, context, semanticModel) |
                    GuidAnalyzer.RegisterDiagnostic(declaration, context, semanticModel) |
                    IOTypesAnalyzer.RegisterDiagnostic(declaration, context, semanticModel) |
                    ThreadTaskAnalyzer.RegisterDiagnostic(declaration, context, semanticModel) |
                    TimerAnalyzer.RegisterDiagnostic(declaration, context, semanticModel) |
                    RegisterDiagnostics(declaration, context, semanticModel))
                {
                    method.IsDeterministic = false;
                }
            }

            return(methodInformationList);
        }
Beispiel #3
0
        private void RegisterAnalyzers(CompilationAnalysisContext context)
        {
            var methodInvocationAnalyzer = new MethodInvocationAnalyzer();
            var orchestratorMethods      = orchestratorMethodCollector.GetOrchestratorMethods();

            foreach (var methodInformation in orchestratorMethods)
            {
                var semanticModel     = methodInformation.SemanticModel;
                var methodDeclaration = methodInformation.Declaration;

                // | is the non short circuit or; this is important so that each method analyzes the code and reports all needed diagnostics.
                if (DateTimeAnalyzer.RegisterDiagnostic(context, semanticModel, methodDeclaration)
                    | EnvironmentVariableAnalyzer.RegisterDiagnostic(context, semanticModel, methodDeclaration)
                    | GuidAnalyzer.RegisterDiagnostic(context, semanticModel, methodDeclaration)
                    | IOTypesAnalyzer.RegisterDiagnostic(context, semanticModel, methodDeclaration)
                    | ThreadTaskAnalyzer.RegisterDiagnostic(context, semanticModel, methodDeclaration)
                    | TimerAnalyzer.RegisterDiagnostic(context, semanticModel, methodDeclaration)
                    | CancellationTokenAnalyzer.RegisterDiagnostic(context, methodDeclaration))
                {
                    methodInvocationAnalyzer.RegisterDiagnostics(context, methodInformation);
                }
            }
        }