Skip to content

Commit

Permalink
Fix RCS0060 (dotnet#1139)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored and JochemHarmes committed Oct 30, 2023
1 parent fbe3c4c commit fc8e8ce
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
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
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
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 fc8e8ce

Please sign in to comment.