Function Complexity Advisor is a powerful VS Code extension designed to help developers identify, measure, and refactor complex code in real-time. By providing immediate visual feedback and project-wide analytics, it ensures your codebase stays maintainable, clean, and follows the Single Responsibility Principle (SRP).
🎯 The Goal
The primary goal of this extension is to reduce cognitive load. It prevents "God functions" and ensures each block of code does one thing well, helping teams maintain high code quality standards effortlessly.
🔥 Key Features
1. Real-time Complexity Heatmap 🟢🟡🔴
Visual decorations highlight function complexity directly in your editor:
- Green: Low complexity (0–3) ✅
- Yellow: Medium complexity (4–6) ⚠️
- Red: High complexity (7–10) 🚨
2. Project Complexity Dashboard
Get a "bird's-eye view" of your entire workspace. Identify worst-offender files and track your project's average complexity score.
3. Smart Metrics
Beyond just lines of code, we calculate:
- Cyclomatic Complexity: Decision point counting (if, loops, etc.).
- Nesting Depth: Deep logic detection.
- Function Call Count: External dependency tracking.
- SRP Detection: Heuristic-based detection of multiple responsibilities (Validation, DB, API, etc.).
4. Team Rules Engine
Enforce team standards via a [.complexityrc.json](file:///c:/Users/Martins Onyia/Documents/Projects/function-complexity-advisor/.complexityrc.json) file. Customize thresholds for every metric to fit your project's needs.
⌨️ Keyboard Shortcuts (The "Command Center")
| Shortcut | Action |
|---|---|
Ctrl + Shift + D, then B |
Dashboard View (Full project metrics) |
Ctrl + Shift + D, then H |
Toggle Heatmap (Show/Hide highlights instantly) |
Ctrl + Shift + D, then R |
Rules UI (Adjust thresholds in Settings) |
⚙️ Configuration
You can customize the advisor in your VS Code Settings:
- Press
Ctrl + , - Search for "Function Complexity Advisor"
- Adjust thresholds for lines, nesting, calls, and more.
📧 Feedback & Support
We love hearing from you! If you have any suggestions, found a bug, or just want to say hi, reach out to us:
- Email: [email protected]
- Repo: [GitHub Issues](https://github.com/ugly-ceaser/function-complexity-advisor/blob/HEAD/ https:/github.com/ugly-ceaser)
Happy Refactoring! 🚀