-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
area:toolingArea: tooling and CLIArea: tooling and CLIbugSomething isn't workingSomething isn't workingpriority:p2Priority P2 (medium)Priority P2 (medium)
Milestone
Description
Summary
PyAnalyzer uses a recursive findNodesByType traversal for functions, methods, and assignments. This pulls in nested functions (inside methods) and local assignments, causing duplicate module functions and spurious class properties.
Failure mode
- Methods are also emitted as module-level functions.
- Nested inner functions inside methods are emitted as class methods.
- Local assignments inside methods are recorded as class properties.
Evidence
src/core/analyzer.ts:extractFunctionscallsfindNodesByType(root, 'function_definition').extractClassusesfindNodesByType(bodyNode, 'function_definition')andfindNodesByType(bodyNode, 'assignment').findNodesByTypetraverses the full subtree, including nested scopes.
Proposed fix
- Only consider direct children of the module/class body for functions and assignments.
- When extracting class members, avoid descending into function bodies.
- Add tests with nested functions and method-local assignments to ensure they’re ignored.
Acceptance criteria
- Module-level functions exclude class methods and nested functions.
- Class methods exclude nested inner functions.
- Class properties exclude assignments inside methods.
- Tests cover nested scopes and confirm correct extraction.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:toolingArea: tooling and CLIArea: tooling and CLIbugSomething isn't workingSomething isn't workingpriority:p2Priority P2 (medium)Priority P2 (medium)