Skip to content

Commit

Permalink
Fix RCS0049 (#1386)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored Feb 7, 2024
1 parent 0ff1340 commit 972b3f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `items.Select(selector).Average()` => `items.Average(selector)`
- `items.Select(selector).Sum()` => `items.Sum(selector)`

### Fixed

- Fix analyzer [RCS0049](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0049) ([PR](https://github.com/dotnet/roslynator/pull/1386))

## [4.10.0] - 2024-01-24

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ private static void AnalyzeCompilationUnit(SyntaxNodeAnalysisContext context)

TriviaBlock block = TriviaBlock.FromLeading(node);

if (block.Kind == TriviaBlockKind.NewLine)
if (block.Kind == TriviaBlockKind.NewLine
&& block.ContainsSingleLineComment)
{
DiagnosticHelpers.ReportDiagnostic(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ await VerifyNoDiagnosticAsync(@"// x
class C
{
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.AddBlankLineAfterTopComment)]
public async Task TestNoDiagnostic_NoComment()
{
await VerifyNoDiagnosticAsync(@"
class C
{
}
");
}
}

0 comments on commit 972b3f7

Please sign in to comment.