Skip to content

Commit

Permalink
Fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornhellander committed Jun 8, 2024
1 parent cc18acf commit a5c1d42
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -67,8 +67,6 @@ internal class SA1629DocumentationTextMustEndWithAPeriod : ElementDocumentationB

private static readonly ImmutableDictionary<string, string> NoCodeFixProperties = ImmutableDictionary.Create<string, string>().Add(NoCodeFixKey, string.Empty);

private static readonly Regex XmlEntityRegex = new Regex("&[a-z]+;$");

/// <summary>
/// Initializes a new instance of the <see cref="SA1629DocumentationTextMustEndWithAPeriod"/> class.
/// </summary>
Expand Down Expand Up @@ -134,9 +132,9 @@ private static void HandleSectionOrBlockXmlElement(SyntaxNodeAnalysisContext con
{
int spanStart = textToken.SpanStart + textWithoutTrailingWhitespace.Length;
ImmutableDictionary<string, string> 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();
Expand Down

0 comments on commit a5c1d42

Please sign in to comment.