Analyzes code complexity in real-time within VS Code.
Provides a detailed dashboard with 9 key code metrics.
Works with any programming language to improve code quality.
Pricing: Free plan available
Best for: Growing teams
Pros & Cons
Pros
Provides immediate feedback on code quality
Supports a wide range of programming languages
Offers actionable insights with healthy thresholds and refactoring tips
Integrates seamlessly into the VS Code environment
Helps developers write more maintainable and readable code
Cons
Currently only available as a VS Code extension
May require developers to learn new metrics and their implications
Key Features
Real-time metric updates as you type, save, or switch filesDedicated sidebar panel for a rich metrics dashboardStatus bar badge displaying complexity labels (Low, Medium, High, Very High, Critical)Info tooltips for each metric explaining its meaning and healthy thresholdsMulti-language support for TypeScript, JavaScript, Python, Go, Rust, and more9 key metrics: Complexity Score, Maintainability Index, LOC, Function Count, Cyclomatic Complexity, Max Nesting Depth, Average Parameters, Comment Ratio, Import Count
Complexity Indicator is a VS Code extension designed to help developers understand and improve the quality of their codebase by providing real-time complexity analysis. It displays a rich metrics dashboard directly in the sidebar, offering insights into various aspects of code health for the active file. While initially conceived with Flutter/Dart developers in mind, its functionality extends to any programming language, making it a versatile tool for a wide range of developers.
The extension continuously updates metrics as you type, save, or switch files, ensuring you always have an up-to-date view of your code's complexity. It presents a comprehensive set of 9 metrics, including a weighted Complexity Score, Maintainability Index, Lines of Code (LOC), Function Count, Cyclomatic Complexity, Max Nesting Depth, Average Parameters, Comment Ratio, and Import Count. Each metric comes with clear explanations, healthy thresholds, and actionable advice, helping developers identify areas for refactoring and maintain clean, readable, and testable code. A status bar badge provides an at-a-glance complexity label (Low, Medium, High, Very High, Critical), allowing for quick assessment of file health.
How does the Complexity Score combine different metrics?
The Complexity Score is a single weighted score from 0-100 that aggregates several signals: Cyclomatic Complexity (35%), Max Nesting Depth (25%), Lines of Code (20%), Average Parameters (12%), and Function Count (8%). A lower score indicates better code health, with a target of ≤ 40.
What is the significance of the Maintainability Index and how is it calculated?
The Maintainability Index (MI) is a score from 0-100, based on a normalized Microsoft formula, where higher is better. It's calculated as MI = 171 − 0.23 × CC − 16.2 × ln(LOC) + 50 × √(2.46 × commentRatio). A score ≥ 85 is excellent, while < 50 suggests refactoring is needed.
How does the extension help identify overly complex functions or files?
The extension uses metrics like Cyclomatic Complexity (counting independent execution paths), Max Nesting Depth (deepest control flow structures), and Function Count. For instance, a Cyclomatic Complexity > 20 indicates high risk, Max Nesting Depth ≥ 5 is considered dangerous, and files with > 15 functions often benefit from splitting.
What are the recommended thresholds for code readability and documentation according to the extension?
For readability, the extension suggests keeping files under 300 Lines of Code (LOC). For documentation, a healthy Comment Ratio is between 15-30%. Too low may mean under-documented code, while too high could indicate outdated or noisy comments.