public override bool CanSuppress(SemanticModel model, SyntaxNode syntax, DiagnosticId ruleId)
        {
            var memberAccessExpressionSyntax = syntax as MemberAccessExpressionSyntax;

            if (_sanitizedSourceAnalyzer.IsSymbolSanitized(model.GetSymbolInfo(memberAccessExpressionSyntax), ruleId))
            {
                return(true);
            }

            return(base.CanSuppress(model, syntax, ruleId));
        }
        public override bool CanSuppress(SemanticModel model, SyntaxNode syntax, DiagnosticId ruleId)
        {
            var identifierNameSyntax = syntax as IdentifierNameSyntax;
            var symbolInfo           = model.GetSymbolInfo(identifierNameSyntax);

            if (_sanitizedSourceAnalyzer.IsSymbolSanitized(symbolInfo, ruleId))
            {
                return(true);
            }

            return(base.CanSuppress(model, syntax, ruleId));
        }
Example #3
0
        public override bool CanSuppress(SemanticModel model, SyntaxNode syntax, DiagnosticId ruleId)
        {
            var invocationExpressionSyntax = syntax as InvocationExpressionSyntax;

            if (_sanitizedSourceAnalyzer.IsSymbolSanitized(model.GetSymbolInfo(invocationExpressionSyntax), ruleId))
            {
                return(true);
            }

            var argsSafe = CanSuppressArguments(model, invocationExpressionSyntax.ArgumentList, ruleId);

            var isArgsOnlyExpression = _argsOnlyInvocationExpression.Execute(model, invocationExpressionSyntax);

            if (isArgsOnlyExpression)
            {
                return(argsSafe);
            }

            var isBodySafe = CanSuppressExpression(model, invocationExpressionSyntax.Expression, ruleId);

            return(argsSafe && isBodySafe);
        }