Skip to content

Commit

Permalink
Fix RCS0060 (#1139)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Jul 28, 2023
1 parent a0c7f3c commit 932e041
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [CLI] Fix member full declaration in generated documentation (command `generate-doc`) ([#1130](https://github.com/josefpihrt/roslynator/pull/1130)).
- Append `?` to nullable reference types.
- Fix [RCS1179](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1179.md) ([#1129](https://github.com/JosefPihrt/Roslynator/pull/1129)).
- Fix [RCS0060](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS0060.md) ([#1139](https://github.com/JosefPihrt/Roslynator/pull/1139)).

## [4.3.0] - 2023-04-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ private static void AnalyzeFileScopedNamespaceDeclaration(SyntaxNodeAnalysisCont

SyntaxNode node = GetNodeAfterNamespaceDeclaration(namespaceDeclaration);

if (node is null)
return;

BlankLineStyle style = context.GetBlankLineAfterFileScopedNamespaceDeclaration();

if (style == BlankLineStyle.None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,21 @@ class C
}
", options: Options.AddConfigOption(ConfigOptionKeys.BlankLineAfterFileScopedNamespaceDeclaration, false));
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.BlankLineAfterFileScopedNamespaceDeclaration)]
public async Task TestNoDiagnostic_EmptyFileWithComment()
{
await VerifyNoDiagnosticAsync(@"
namespace A.B;
// x", options: Options.AddConfigOption(ConfigOptionKeys.BlankLineAfterFileScopedNamespaceDeclaration, false));
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.BlankLineAfterFileScopedNamespaceDeclaration)]
public async Task TestNoDiagnostic_EmptyFileWithComment2()
{
await VerifyNoDiagnosticAsync(@"
namespace A.B;
// x", options: Options.AddConfigOption(ConfigOptionKeys.BlankLineAfterFileScopedNamespaceDeclaration, true));
}
}

0 comments on commit 932e041

Please sign in to comment.