Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

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

## [4.12.5] - 2024-09-13

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public override void Initialize(AnalysisContext context)
{
base.Initialize(context);

context.RegisterSyntaxNodeAction(f => AnalyzeNamespaceDeclaration(f), SyntaxKind.NamespaceDeclaration);
context.RegisterSyntaxNodeAction(f => AnalyzeClassDeclaration(f), SyntaxKind.ClassDeclaration);
context.RegisterSyntaxNodeAction(f => AnalyzeStructDeclaration(f), SyntaxKind.StructDeclaration);
#if ROSLYN_4_0
Expand All @@ -53,18 +52,6 @@ public override void Initialize(AnalysisContext context)
context.RegisterSyntaxNodeAction(f => AnalyzeEventDeclaration(f), SyntaxKind.EventDeclaration);
}

private static void AnalyzeNamespaceDeclaration(SyntaxNodeAnalysisContext context)
{
if (AnalyzeLeading(context))
return;

var namespaceDeclaration = (NamespaceDeclarationSyntax)context.Node;

TrailingAnalysis? analysis = AnalyzeTrailing(namespaceDeclaration.Name);

ReportDiagnostic(context, analysis);
}

private static void AnalyzeClassDeclaration(SyntaxNodeAnalysisContext context)
{
if (AnalyzeLeading(context))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,16 @@ void M1() //x
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.ConvertCommentToDocumentationComment)]
public async Task TestNoDiagnostic_NamespaceDeclaration()
{
await VerifyNoDiagnosticAsync(@"
namespace N // Some comment
{
class C
{
}
}");
}
}