Skip to content

Commit e07914c

Browse files
authored
Fix analyzer RCS1181 (#1526)
1 parent 9335c71 commit e07914c

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

ChangeLog.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
- Fix analyzer [RCS0053](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0053) ([PR](https://github.com/dotnet/roslynator/pull/1518))
1717
- Fix analyzer [RCS0056](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0056) ([PR](https://github.com/dotnet/roslynator/pull/1521))
18+
- Fix analyzer [RCS1181](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1181) ([PR](https://github.com/dotnet/roslynator/pull/1526))
1819

1920
## [4.12.5] - 2024-09-13
2021

src/Analyzers/CSharp/Analysis/ConvertCommentToDocumentationCommentAnalyzer.cs

-13
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public override void Initialize(AnalysisContext context)
3030
{
3131
base.Initialize(context);
3232

33-
context.RegisterSyntaxNodeAction(f => AnalyzeNamespaceDeclaration(f), SyntaxKind.NamespaceDeclaration);
3433
context.RegisterSyntaxNodeAction(f => AnalyzeClassDeclaration(f), SyntaxKind.ClassDeclaration);
3534
context.RegisterSyntaxNodeAction(f => AnalyzeStructDeclaration(f), SyntaxKind.StructDeclaration);
3635
#if ROSLYN_4_0
@@ -53,18 +52,6 @@ public override void Initialize(AnalysisContext context)
5352
context.RegisterSyntaxNodeAction(f => AnalyzeEventDeclaration(f), SyntaxKind.EventDeclaration);
5453
}
5554

56-
private static void AnalyzeNamespaceDeclaration(SyntaxNodeAnalysisContext context)
57-
{
58-
if (AnalyzeLeading(context))
59-
return;
60-
61-
var namespaceDeclaration = (NamespaceDeclarationSyntax)context.Node;
62-
63-
TrailingAnalysis? analysis = AnalyzeTrailing(namespaceDeclaration.Name);
64-
65-
ReportDiagnostic(context, analysis);
66-
}
67-
6855
private static void AnalyzeClassDeclaration(SyntaxNodeAnalysisContext context)
6956
{
7057
if (AnalyzeLeading(context))

src/Tests/Analyzers.Tests/RCS1181ConvertCommentToDocumentationCommentTests.cs

+12
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,16 @@ void M1() //x
330330
}
331331
");
332332
}
333+
334+
[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.ConvertCommentToDocumentationComment)]
335+
public async Task TestNoDiagnostic_NamespaceDeclaration()
336+
{
337+
await VerifyNoDiagnosticAsync(@"
338+
namespace N // Some comment
339+
{
340+
class C
341+
{
342+
}
343+
}");
344+
}
333345
}

0 commit comments

Comments
 (0)