コード例 #1
0
        public static void Analyze(SyntaxNodeAnalysisContext context, DocumentationCommentTriviaSyntax documentationComment)
        {
            XmlElementSyntax summaryElement = FormatSummaryRefactoring.GetSummaryElement(documentationComment);

            if (summaryElement?.StartTag?.IsMissing == false &&
                summaryElement.EndTag?.IsMissing == false &&
                summaryElement.IsSingleLine(includeExteriorTrivia: false, trim: false))
            {
                context.ReportDiagnostic(
                    DiagnosticDescriptors.FormatDocumentationSummaryOnMultipleLines,
                    summaryElement.GetLocation());
            }
        }
コード例 #2
0
        public static void AnalyzeSingleLineDocumentationCommentTrivia(SyntaxNodeAnalysisContext context)
        {
            var documentationComment = (DocumentationCommentTriviaSyntax)context.Node;

            XmlElementSyntax summaryElement = documentationComment.SummaryElement();

            if (summaryElement?.StartTag?.IsMissing == false &&
                summaryElement.EndTag?.IsMissing == false &&
                summaryElement.IsSingleLine(includeExteriorTrivia: false, trim: false))
            {
                DiagnosticHelpers.ReportDiagnostic(context,
                                                   DiagnosticDescriptors.FormatDocumentationSummaryOnMultipleLines,
                                                   summaryElement);
            }
        }
コード例 #3
0
        private void AnalyzeDocumentationComment(SyntaxNodeAnalysisContext context)
        {
            if (GeneratedCodeAnalyzer?.IsGeneratedCode(context) == true)
            {
                return;
            }

            var documentationComment = (DocumentationCommentTriviaSyntax)context.Node;

            XmlElementSyntax summaryElement = FormatSummaryRefactoring.GetSummaryElement(documentationComment);

            if (summaryElement?.StartTag?.IsMissing == false &&
                summaryElement.EndTag?.IsMissing == false &&
                summaryElement.IsSingleLine(includeExteriorTrivia: false, trim: false))
            {
                context.ReportDiagnostic(
                    DiagnosticDescriptors.FormatDocumentationSummaryOnMultipleLines,
                    summaryElement.GetLocation());
            }
        }