Skip to content

Commit 32ccfc8

Browse files
authored
Fix analyzer RCS0005 (#1621)
1 parent 7b95c1b commit 32ccfc8

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Fix analyzer [RCS1229](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1229) ([PR](https://github.com/dotnet/roslynator/pull/1618))
1313
- Fix analyzer [RCS1174](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1174) ([PR](https://github.com/dotnet/roslynator/pull/1619))
1414
- Fix analyzer [RCS0010](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0010) ([PR](https://github.com/dotnet/roslynator/pull/1620))
15+
- Fix analyzer [RCS0005](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0005) ([PR](https://github.com/dotnet/roslynator/pull/1621))
1516

1617
### Added
1718

src/Formatting.Analyzers/CSharp/AddBlankLineBeforeEndRegionDirectiveAnalyzer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ static bool IsPrecededWithEmptyLineOrRegionDirective(EndRegionDirectiveTriviaSyn
8282
SyntaxKind.EndOfLineTrivia,
8383
SyntaxKind.RegionDirectiveTrivia,
8484
SyntaxKind.EndRegionDirectiveTrivia,
85-
SyntaxKind.PragmaWarningDirectiveTrivia);
85+
SyntaxKind.PragmaWarningDirectiveTrivia,
86+
SyntaxKind.EndIfDirectiveTrivia);
8687
}
8788
}
8889

src/Tests/Formatting.Analyzers.Tests/RCS0005AddBlankLineBeforeEndRegionDirectiveTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,23 @@ class C
251251
}
252252
}");
253253
}
254+
255+
[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.AddBlankLineBeforeEndRegionDirective)]
256+
public async Task TestNoDiagnostic_IfDirectiveInsideRegion()
257+
{
258+
await VerifyNoDiagnosticAsync("""
259+
namespace N
260+
{
261+
#region Some region
262+
263+
#if DEBUG
264+
// Some code
265+
#else
266+
// Some code
267+
#endif
268+
269+
#endregion Some region
270+
}
271+
""");
272+
}
254273
}

0 commit comments

Comments
 (0)