コード例 #1
0
        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);
        }
コード例 #2
0
 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));
         }
     }
 }