Exemplo n.º 1
0
        private void AnalyzedInterfaceDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsGeneratedCode())
            {
                return;
            }

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

            if (!CommentsManager.HasValidSummaryComments(context.Node))
            {
                DiagnosticsManager.CreateCommentsDiagnostic(context, declaration.Identifier.Text, declaration.Identifier.GetLocation(), Rule);
            }
        }
Exemplo n.º 2
0
        private void AnalyzedClassDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsGeneratedCode())
            {
                return;
            }

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

            if (IsExternallyVisibleComments(declaration.Modifiers) && !CommentsManager.HasValidSummaryComments(context.Node))
            {
                DiagnosticsManager.CreateCommentsDiagnostic(context, declaration.Identifier.Text, declaration.Identifier.GetLocation(), Rule);
            }
        }
        private void AnalyzedMethodDeclaration(SyntaxNodeAnalysisContext context)
        {
            if (context.IsAutomaticallyGeneratedCode())
            {
                return;
            }

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

            // if this method is within an interface then we do not need to process with access qualifier check
            var interfaceDeclaration = Cast <InterfaceDeclarationSyntax>(declaration.Parent);

            if (((interfaceDeclaration == null && IsExternallyVisibleComments(declaration.Modifiers)) || interfaceDeclaration != null) &&
                !CommentsManager.HasValidSummaryComments(context.Node))
            {
                DiagnosticsManager.CreateCommentsDiagnostic(context, declaration.Identifier.Text, declaration.Identifier.GetLocation(), Rule);
            }
        }