diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1629DocumentationTextMustEndWithAPeriod.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1629DocumentationTextMustEndWithAPeriod.cs index c989fb472..2a0f774cd 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1629DocumentationTextMustEndWithAPeriod.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1629DocumentationTextMustEndWithAPeriod.cs @@ -9,9 +9,9 @@ namespace StyleCop.Analyzers.DocumentationRules using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; - using System.Text.RegularExpressions; using System.Xml.Linq; using Microsoft.CodeAnalysis; + using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Text; @@ -67,8 +67,6 @@ internal class SA1629DocumentationTextMustEndWithAPeriod : ElementDocumentationB private static readonly ImmutableDictionary NoCodeFixProperties = ImmutableDictionary.Create().Add(NoCodeFixKey, string.Empty); - private static readonly Regex XmlEntityRegex = new Regex("&[a-z]+;$"); - /// /// Initializes a new instance of the class. /// @@ -134,9 +132,9 @@ private static void HandleSectionOrBlockXmlElement(SyntaxNodeAnalysisContext con { int spanStart = textToken.SpanStart + textWithoutTrailingWhitespace.Length; ImmutableDictionary properties = null; - if (textWithoutTrailingWhitespace.EndsWith(",", StringComparison.Ordinal) || - (textWithoutTrailingWhitespace.EndsWith(";", StringComparison.Ordinal) && - !XmlEntityRegex.IsMatch(textWithoutTrailingWhitespace))) + if (textWithoutTrailingWhitespace.EndsWith(",", StringComparison.Ordinal) + || (textWithoutTrailingWhitespace.EndsWith(";", StringComparison.Ordinal) + && !textToken.IsKind(SyntaxKind.XmlEntityLiteralToken))) { spanStart -= 1; SetReplaceChar();