📊 Code Complexity Analyzer

Cyclomatic · Cognitive · Maintainability — 100% client‑side
📝 Code Input (JavaScript / TypeScript)

🛡️ All analysis runs locally. Your code never leaves this browser.

🏆 Maintainability Index
Cyclomatic
0
Cognitive
0
Lines of Code
0
Functions
0
📋 Function Details Sorted by cognitive complexity
Click "Analyze" to see results
✓ AST‑powered · No server · Instant feedback

📘 What is Code Complexity?

Cyclomatic Complexity measures the number of linearly independent paths through a program (testability). Cognitive Complexity measures how difficult the code is for a human to understand (readability).

❓ Frequently Asked Questions

What is a good cyclomatic complexity score?

1-10 is considered simple and low risk. 11-20 is moderate. 21-50 is complex and risky. Above 50 is untestable and should be refactored.

How is cognitive complexity calculated?

It adds extra weight for nesting and structural breaks (e.g., `if` inside `if`). The default threshold for concern is 15.

What is the Maintainability Index?

A 0-100 score combining Halstead Volume, Cyclomatic Complexity, and Lines of Code. Higher is better; a score below 65 indicates maintainability issues.

Is my code safe?

Absolutely. The analysis uses Acorn to parse code entirely in your browser. No data is ever sent to any server.

Which languages are supported?

Currently JavaScript and TypeScript (including JSX/TSX). More languages may be added in the future.