Exemple #1
0
        private void AnalyzeLocalDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsAutomaticallyGeneratedCode())
            {
                return;
            }

            var declaration = Cast <LocalDeclarationStatementSyntax>(context.Node);

            var variableDeclarator = declaration.Declaration.Variables.FirstOrDefault()?.Identifier.Text;

            RegexManager.DoesNotSatisfyLocalVariableNameRule(context, variableDeclarator, declaration.GetLocation(), Rule);
        }
Exemple #2
0
        private void AnalyzeMethodDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsAutomaticallyGeneratedCode())
            {
                return;
            }

            var declaration = Cast <MethodDeclarationSyntax>(context.Node);

            RegexManager.DoesNotSatisfyNonPrivateNameRule(context, declaration.Identifier.Text, declaration.Identifier.GetLocation(), Rule);

            foreach (var parameter in declaration.ParameterList.Parameters)
            {
                RegexManager.DoesNotSatisfyLocalVariableNameRule(context, parameter.Identifier.Text, parameter.Identifier.GetLocation(), Rule);
            }
        }