public static void AnalyzeXML(SyntaxNodeAnalysisContext context) { var comment = context.Node as DocumentationCommentTriviaSyntax; var comments = comment .DescendantTokens() .Where(t => t.IsKind(SyntaxKind.XmlTextLiteralToken)) .Select(t => new Comment(t)); var commentContext = new CommentContext(context); Report(commentContext, comments); }
private static void Report(CommentContext context, IEnumerable <Comment> comments) { foreach (var c in comments) { var text = c.GetText; var location = c.GetLocation; if (IsRussian) { if (text.IsNotRussian()) { context.ReportDiagnostic(Diagnostic.Create(RussianRule, location)); } } else if (text.IsNotEnglish()) { context.ReportDiagnostic(Diagnostic.Create(EnglishRule, location)); } } }