Skip to content

Commit b49b029

Browse files
Fix file-scoped namespace collection on net8.0
Restore unconditional FileScopedNamespaceDeclarationSyntax handling; the vs-extension ROSLYN_4_0_OR_GREATER guard is undefined on master. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a278bd9 commit b49b029

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

CognitiveCodeAnalysis/src/CognitiveAnalysis/CognitiveCodeAnalyser.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ private static IEnumerable<string> CollectNestedClasses(ClassDeclarationSyntax c
368368
// Collect namespace parts (including file-scoped namespaces)
369369
private static IEnumerable<string> CollectNamespaceParts(ClassDeclarationSyntax classNode)
370370
{
371-
#if ROSLYN_4_0_OR_GREATER
372371
return classNode.Ancestors()
373372
.OfType<NamespaceDeclarationSyntax>()
374373
.Select(n => n.Name.ToString())
@@ -377,12 +376,6 @@ private static IEnumerable<string> CollectNamespaceParts(ClassDeclarationSyntax
377376
.Select(ns => ns.Name.ToString())
378377
)
379378
.Reverse();
380-
#else
381-
return classNode.Ancestors()
382-
.OfType<NamespaceDeclarationSyntax>()
383-
.Select(n => n.Name.ToString())
384-
.Reverse();
385-
#endif
386379
}
387380

388381
private static int CalculateNestingLevels(MethodDeclarationSyntax methodNode, CognitiveConfiguration configuration)

0 commit comments

Comments
 (0)