public static InterproceduralAnalysisConfiguration Create(
            AnalyzerOptions analyzerOptions,
            DiagnosticDescriptor rule,
            InterproceduralAnalysisKind defaultInterproceduralAnalysisKind,
            CancellationToken cancellationToken,
            uint defaultMaxInterproceduralMethodCallChain = DefaultMaxInterproceduralMethodCallChain,
            uint defaultMaxInterproceduralLambdaOrLocalFunctionCallChain = DefaultMaxInterproceduralLambdaOrLocalFunctionCallChain)
        {
            var kind = analyzerOptions.GetInterproceduralAnalysisKindOption(rule, defaultInterproceduralAnalysisKind, cancellationToken);

            var maxInterproceduralMethodCallChain = analyzerOptions.GetUnsignedIntegralOptionValue(
                optionName: EditorConfigOptionNames.MaxInterproceduralMethodCallChain,
                rule: rule,
                defaultValue: defaultMaxInterproceduralMethodCallChain,
                cancellationToken: cancellationToken);

            var maxInterproceduralLambdaOrLocalFunctionCallChain = analyzerOptions.GetUnsignedIntegralOptionValue(
                optionName: EditorConfigOptionNames.MaxInterproceduralLambdaOrLocalFunctionCallChain,
                rule: rule,
                defaultValue: defaultMaxInterproceduralLambdaOrLocalFunctionCallChain,
                cancellationToken: cancellationToken);

            return(new InterproceduralAnalysisConfiguration(
                       kind, maxInterproceduralMethodCallChain, maxInterproceduralLambdaOrLocalFunctionCallChain));
        }
        private static InterproceduralAnalysisConfiguration Create(
            AnalyzerOptions analyzerOptions,
            DiagnosticDescriptor rule,
            SyntaxTree tree,
            Compilation compilation,
            InterproceduralAnalysisKind defaultInterproceduralAnalysisKind,
            uint defaultMaxInterproceduralMethodCallChain = DefaultMaxInterproceduralMethodCallChain,
            uint defaultMaxInterproceduralLambdaOrLocalFunctionCallChain = DefaultMaxInterproceduralLambdaOrLocalFunctionCallChain)
        {
            var kind = analyzerOptions.GetInterproceduralAnalysisKindOption(rule, tree, compilation, defaultInterproceduralAnalysisKind);

            var maxInterproceduralMethodCallChain = analyzerOptions.GetUnsignedIntegralOptionValue(
                optionName: EditorConfigOptionNames.MaxInterproceduralMethodCallChain,
                rule: rule,
                tree,
                compilation,
                defaultValue: defaultMaxInterproceduralMethodCallChain);

            var maxInterproceduralLambdaOrLocalFunctionCallChain = analyzerOptions.GetUnsignedIntegralOptionValue(
                optionName: EditorConfigOptionNames.MaxInterproceduralLambdaOrLocalFunctionCallChain,
                rule: rule,
                tree,
                compilation,
                defaultValue: defaultMaxInterproceduralLambdaOrLocalFunctionCallChain);

            return(new InterproceduralAnalysisConfiguration(
                       kind, maxInterproceduralMethodCallChain, maxInterproceduralLambdaOrLocalFunctionCallChain));
        }
Example #3
0
 public static InterproceduralAnalysisKind GetInterproceduralAnalysisKindOption(
     this AnalyzerOptions options,
     DiagnosticDescriptor rule,
     ISymbol symbol,
     Compilation compilation,
     InterproceduralAnalysisKind defaultValue,
     CancellationToken cancellationToken)
 => options.GetInterproceduralAnalysisKindOption(rule, symbol.Locations[0].SourceTree, compilation, defaultValue, cancellationToken);
Example #4
0
 public static InterproceduralAnalysisKind GetInterproceduralAnalysisKindOption(
     this AnalyzerOptions options,
     DiagnosticDescriptor rule,
     ISymbol symbol,
     Compilation compilation,
     InterproceduralAnalysisKind defaultValue)
 => TryGetSyntaxTreeForOption(symbol, out var tree)
     ? options.GetInterproceduralAnalysisKindOption(rule, tree, compilation, defaultValue)
     : defaultValue;