Nifty Code Metrics
Complexity and size for every function in any language, as CodeLens and warnings, plus a hotspots view of the complex files that change most often.
Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.
Features



- Complexity above every function. A CodeLens shows each function's cyclomatic complexity and size, e.g.
Complexity 14 (high) · 52 lines, in TypeScript, JavaScript, Python, Go, Rust, Java, C#, C/C++, PHP, Ruby, Kotlin, Swift and more. Click it to see what the number means and how to bring it down.
- Any language. Functions come from the language's own outline, so every language with an outline works. For Python, Ruby, Lua and shell scripts, functions are also found by indentation when no language server is installed. Comments and strings are ignored, and nested functions are counted separately.
- Warnings where it matters. Functions at or over the threshold (10 by default) are flagged as hints, or as information or warnings if you prefer, so they show up in the Problems panel.
- Status bar. Shows the complexity of the function at the cursor, turning yellow over the threshold and red at twice it.
- Functions by complexity. Show Functions by Complexity lists the file's functions with the most complex first. Pick one to jump to it.
- Complexity hotspots. A view in the Explorer ranks the files that are both complex and changed often in git. Those are the files where bugs cluster and refactoring pays off first.
- Hotspot reports. Export the ranked hotspots as Markdown or CSV for a pull request, a tech-debt review or a spreadsheet.
Commands
| Command |
What it does |
Nifty Code Metrics: Show Functions by Complexity |
List the file's functions, most complex first, and jump to one |
Nifty Code Metrics: Explain Complexity at Cursor |
Complexity, size and nesting of the function at the cursor |
Nifty Code Metrics: Refresh Hotspots |
Rescan the workspace for hotspots |
Nifty Code Metrics: Export Hotspots Report |
Save the hotspots as Markdown or CSV |
Settings
| Setting |
Default |
What it does |
nifty.metrics.threshold |
10 |
Complexity at which a function counts as complex (twice this is "very high") |
nifty.metrics.codeLens |
all |
all, complex (only over the threshold) or off |
nifty.metrics.diagnostics |
hint |
Report complex functions as hint, information or warning, or off |
nifty.metrics.statusBar |
true |
Show the complexity at the cursor in the status bar |
nifty.metrics.languages |
common languages |
Language IDs to measure |
nifty.metrics.churnMonths |
12 |
Months of git history that count as churn for hotspots |
nifty.metrics.hotspotCount |
50 |
How many files the hotspots view lists |
nifty.metrics.hotspotMaxFiles |
5000 |
Most source files to scan for hotspots |
nifty.metrics.hotspotExclude |
build and dependency folders |
Glob of files the hotspots view leaves out |
How it's measured
Cyclomatic complexity is 1 plus the number of decision points: if, else if, loops, case/when arms, catch/except, &&, ||, ?? and the ternary ?: (or and/or in Python, Ruby and Lua). The hotspot score is complexity × log₂(2 + commits in the churn window), so a moderately complex file that changes every week ranks above a huge one nobody touches.
Install
- VS Code: search for "Nifty Code Metrics" in the Extensions view, or install from the Visual Studio Marketplace.
- Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.
Privacy
This extension collects no telemetry and needs no account.
- Nifty Data Viewer: CSV & Parquet Viewer with SQL: Open CSV, Parquet and JSON files as a fast table and query them with SQL, powered by DuckDB. Sort, page through millions of rows, and export to CSV, Parquet or JSON. (Open VSX)
- Nifty Git Graph: Git History & Branch Graph: See your git history as a graph: branches, merges and tags, commit details and diffs, and checkout, merge, rebase, cherry-pick and more from a right-click. No sign-in. (Open VSX)
- Nifty Import Cost: Bundle Size of Imports: See the bundle size of every import inline, fast and cached, without maxing out your CPU. (Open VSX)
- Nifty JSON: Formatter, Validator & JSONPath: Format, minify, sort keys, query with JSONPath, copy paths, generate TypeScript types, and browse huge JSON files in a fast tree view. (Open VSX)
- Nifty Mermaid: Mermaid Diagram Preview & Export: Mermaid diagrams with no account: live preview beside .mmd files and Markdown, diagrams in the Markdown preview, syntax highlighting, and export to SVG or PNG. (Open VSX)
- Nifty Monitor: CPU & Memory in the Status Bar: CPU, memory and disk usage in the status bar, including on remote SSH machines and dev containers. (Open VSX)
See all 42 Nifty tools at https://getnifty.dev
| |