PowerShell: no functions, classes or calls are extracted (function_name and simple_name never read; command_expression is not a node kind)
code-review-graph version
2.3.8 (also present on main and staging as of 2026-09-25)
Operating system
Windows 11 and Ubuntu (same result on both)
What happens
PowerShell files produce a File node and nothing else. No Function, no Class, no CALLS edge. So callers_of, impact radius and flows are empty for any .ps1 / .psm1 code, and the empty answers look like "nothing depends on this".
Repro: a repo with one .ps1, one .py and one .sh file.
class Widget {
[string] Name() { return "w" }
}
function Get-Thing {
param([string] $Name)
return Convert-Thing -Value $Name
}
function Convert-Thing {
param([string] $Value)
return $Value.ToUpper()
}
Get-Thing -Name "x"code-review-graph build gives Python 2 Function nodes and bash 2 Function nodes, but PowerShell only the File node.
Why
This is the pattern from #986. Checked against the bundled grammar with Language.id_for_node_kind(name, True):
| Entry in parser.py | Grammar | Result |
|---|---|---|
_FUNCTION_TYPES["powershell"] = ["function_statement"] |
exists (286), but the name is in a function_name child |
_get_name only knows identifier / type_identifier, returns None, node dropped |
_CLASS_TYPES["powershell"] = ["class_statement"] |
exists (331), name in a simple_name child |
same, dropped |
| class methods | class_method_definition (330), name in simple_name |
not listed, never extracted |
_CALL_TYPES["powershell"] = ["command_expression"] |
not a node kind (None) | no calls at all; the real node is command with a command_name child, same shape as bash |
Fix (tested locally on 2.3.8)
- "powershell": ["function_statement"],
+ "powershell": ["function_statement", "class_method_definition"],
- "powershell": ["command_expression"],
+ "powershell": ["command"],
# _get_call_name
- if language == "bash" and node.type == "command":
+ if language in ("bash", "powershell") and node.type == "command":
# _get_name, before the Perl branch
+ if language == "powershell":
+ for child in node.children:
+ if child.type in ("function_name", "simple_name"):
+ return child.text.decode("utf-8", errors="replace")
+ return NoneWith it, the repro gives Get-Thing, Convert-Thing, Name (Function) and Widget (Class), plus Get-Thing -> Convert-Thing and the top-level call. On four real scripts (about 2,500 lines) it went from 4 File nodes to 30 Function nodes with call edges between them. Python and bash node counts did not change.
One side effect to know about: PowerShell's approved verb Test- (for example Test-HttpHealth) makes the test-name heuristic label an ordinary function as Test. It probably wants a PowerShell exception.
Happy to open a PR with a test if that helps.
Source: tirth8205/code-review-graph