Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix analyzer [RCS1085](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1085) ([PR](https://github.com/dotnet/roslynator/pull/1461))
- Fix analyzer [RCS1077](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1077) ([PR](https://github.com/dotnet/roslynator/pull/1463))
- [CLI] Fix `roslynator analyze --include/--exclude` ([PR](https://github.com/dotnet/roslynator/pull/1459))
- Fix analyzer [RCS0036](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0036) ([PR](https://github.com/dotnet/roslynator/pull/1466))

## [4.12.2] - 2024-04-23

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ private static void Analyze(SyntaxNodeAnalysisContext context, SyntaxList<Member
{
if (block.Kind == TriviaBlockKind.BlankLine)
{
if (MemberKindEquals(previousMember, member))
if (!block.ContainsDocumentationComment
&& MemberKindEquals(previousMember, member))
{
ReportDiagnostic(context, DiagnosticRules.RemoveBlankLineBetweenSingleLineDeclarationsOfSameKind, block);
}
}
else
{
Expand Down Expand Up @@ -201,7 +204,8 @@ private static void AnalyzeEnumDeclaration(SyntaxNodeAnalysisContext context)
if ((isSingleLine ?? (isSingleLine = tree.IsSingleLineSpan(member.Span, cancellationToken)).Value)
&& (isPreviousSingleLine ?? tree.IsSingleLineSpan(members[i - 1].Span, cancellationToken)))
{
if (block.Kind == TriviaBlockKind.BlankLine)
if (!block.ContainsDocumentationComment
&& block.Kind == TriviaBlockKind.BlankLine)
{
ReportDiagnostic(context, DiagnosticRules.RemoveBlankLineBetweenSingleLineDeclarationsOfSameKind, block);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,36 @@ class C

string F = null;
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.RemoveBlankLineBetweenSingleLineDeclarationsOfSameKind)]
public async Task TestNoDiagnostic_DocCommentBetweenMembers()
{
await VerifyNoDiagnosticAsync(@"
class C
{
string P1 { get; set; }

/// <summary>
/// </summary>
string P2 { get; set; }
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.RemoveBlankLineBetweenSingleLineDeclarationsOfSameKind)]
public async Task TestNoDiagnostic_DocCommentBetweenEnumMembers()
{
await VerifyNoDiagnosticAsync(@"
enum C
{
A,

/// <summary>
/// </summary>
B,
}
");
}
}