@@ -9,9 +9,9 @@ namespace StyleCop.Analyzers.DocumentationRules
99 using System . Collections . Generic ;
1010 using System . Collections . Immutable ;
1111 using System . Linq ;
12- using System . Text . RegularExpressions ;
1312 using System . Xml . Linq ;
1413 using Microsoft . CodeAnalysis ;
14+ using Microsoft . CodeAnalysis . CSharp ;
1515 using Microsoft . CodeAnalysis . CSharp . Syntax ;
1616 using Microsoft . CodeAnalysis . Diagnostics ;
1717 using Microsoft . CodeAnalysis . Text ;
@@ -67,8 +67,6 @@ internal class SA1629DocumentationTextMustEndWithAPeriod : ElementDocumentationB
6767
6868 private static readonly ImmutableDictionary < string , string > NoCodeFixProperties = ImmutableDictionary . Create < string , string > ( ) . Add ( NoCodeFixKey , string . Empty ) ;
6969
70- private static readonly Regex XmlEntityRegex = new Regex ( "&[a-z]+;$" ) ;
71-
7270 /// <summary>
7371 /// Initializes a new instance of the <see cref="SA1629DocumentationTextMustEndWithAPeriod"/> class.
7472 /// </summary>
@@ -134,9 +132,9 @@ private static void HandleSectionOrBlockXmlElement(SyntaxNodeAnalysisContext con
134132 {
135133 int spanStart = textToken . SpanStart + textWithoutTrailingWhitespace . Length ;
136134 ImmutableDictionary < string , string > properties = null ;
137- if ( textWithoutTrailingWhitespace . EndsWith ( "," , StringComparison . Ordinal ) ||
138- ( textWithoutTrailingWhitespace . EndsWith ( ";" , StringComparison . Ordinal ) &&
139- ! XmlEntityRegex . IsMatch ( textWithoutTrailingWhitespace ) ) )
135+ if ( textWithoutTrailingWhitespace . EndsWith ( "," , StringComparison . Ordinal )
136+ || ( textWithoutTrailingWhitespace . EndsWith ( ";" , StringComparison . Ordinal )
137+ && ! textToken . IsKind ( SyntaxKind . XmlEntityLiteralToken ) ) )
140138 {
141139 spanStart -= 1 ;
142140 SetReplaceChar ( ) ;
0 commit comments