analyze_complexity
Analyze Python code complexity per function in files or directories, returning metrics like cyclomatic, cognitive, nesting depth, length, and letter grades. Sort and filter by complexity.
Instructions
Analyze Python code complexity for a file or directory. Returns per-function metrics: cyclomatic complexity (McCabe), cognitive complexity, nesting depth, function length, and letter grades (A-F).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | Return only top N functions by complexity. 0 = all. | |
| path | Yes | File or directory path to analyze. | |
| sort_by | No | Sort metric (default: complexity). | complexity |
| threshold | No | Cyclomatic complexity threshold (default: 10). |