Skip to content

Commit

Permalink
Merge pull request #3497 from bjornhellander/feature/sa1009cref
Browse files Browse the repository at this point in the history
Updated SA1009 to forbid space after a closing parenthesis in a method reference contained in single quotes
  • Loading branch information
sharwell committed May 2, 2022
2 parents 528d635 + a668ee0 commit 5143909
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Expand Up @@ -85,6 +85,33 @@ public void Method()
await VerifyCSharpFixAsync(testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
}

[Fact]
[WorkItem(2985, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2985")]
public async Task TestDocumentationMethodReferenceInSingleQuotesWithWhitespaceAfterClosingParenthesisAsync()
{
const string testCode = @"
public class Foo
{
/// <see cref='Method({|#0:)|} '/>
public void Method()
{
}
}";

const string fixedCode = @"
public class Foo
{
/// <see cref='Method()'/>
public void Method()
{
}
}";

DiagnosticResult expected = Diagnostic(DescriptorNotFollowed).WithLocation(0);

await VerifyCSharpFixAsync(testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
}

[Fact]
public async Task TestMethodWith2CorrectlySpacedParametersAsync()
{
Expand Down
Expand Up @@ -118,6 +118,7 @@ private static void HandleCloseParenToken(SyntaxTreeAnalysisContext context, Syn
case SyntaxKind.SemicolonToken:
case SyntaxKind.CommaToken:
case SyntaxKind.DoubleQuoteToken:
case SyntaxKind.SingleQuoteToken:
case SyntaxKindEx.DotDotToken:
precedesStickyCharacter = true;
break;
Expand Down

0 comments on commit 5143909

Please sign in to comment.