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()); } }
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); } }
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()); } }