| 512 | |
| 513 | // Label a definition node type as Class / Function / Interface / etc. |
| 514 | function getNodeDisplayLabel(nodeType: string): string { |
| 515 | const lower = nodeType.toLowerCase(); |
| 516 | if (lower.includes('class')) return 'Class'; |
| 517 | if (lower.includes('interface')) return 'Interface'; |
| 518 | if (lower.includes('trait')) return 'Trait'; |
| 519 | if (lower.includes('enum')) return 'Enum'; |
| 520 | if (lower.includes('module')) return 'Module'; |
| 521 | if (lower.includes('struct')) return 'Struct'; |
| 522 | if (lower.includes('variable')) return 'Variable'; |
| 523 | if (lower.includes('impl')) return 'Class'; |
| 524 | if (lower.includes('function') || lower.includes('method') || lower.includes('subroutine')) return 'Function'; |
| 525 | return 'Function'; |
| 526 | } |
| 527 | |
| 528 | function calculateComplexity(node: any): number { |
| 529 | const complexityNodes = new Set([ |