File Metrics
Open any file in the explorer and you’ll see three metric tiles at the top - Maintainability, Cyclomatic, and Cognitive - plus a risk badge next to the filename. Each looks at the file from a different angle; together they tell you how healthy it is and whether it’s worth your time.
Everything is color-coded the same way: green is healthy, amber is worth watching, red needs attention. Here’s what each one means and what you can do about it.
Maintainability
The big one: how easy is this file to work with?
Maintainability is the best single answer to “if I had to change this file tomorrow, how painful would it be?” It’s shown on a 0–100 scale where higher is better, and it rolls several signals - how complex the file is, how large it is, and how well it’s documented - into one number.
| Score | What it means |
|---|---|
| 85–100 · Good | Clear and well-structured. Safe and quick to change. |
| 64–84 · Moderate | Workable, but size or complexity is creeping in. |
| 0–63 · Poor | Dense or sprawling. Changes are slow and easy to get wrong. |
When a file scores low, the metrics below usually explain why - and the Most complex functions list in the file panel points you straight at the parts worth refactoring first.
Cyclomatic complexity
How many paths run through the code?
Every if, loop, and branch adds another route the code can take - and another
route you have to reason about and test. Cyclomatic complexity counts them. The
more paths, the more places a bug can hide and the more tests you need to cover
them all.
| Score | What it means |
|---|---|
| 1–5 · Simple | Easy to follow and test thoroughly. |
| 6–10 · Moderate | Reasonable. Keep an eye on it if it’s climbing. |
| 11+ · Complex | Hard to test completely. A good candidate for breaking up. |
The number shown is for the whole file. The Most complex functions list underneath shows which functions are responsible, so you know exactly where to start.
Cognitive complexity
How hard is this to read?
Two pieces of code can have the same number of branches and still feel completely different to a human - ten simple checks in a row are easy to follow, while the same logic buried five levels deep is a headache. Cognitive complexity captures that difference. It’s the closest thing to “how long will it take a new engineer to understand this?”
| Score | What it means |
|---|---|
| 0–5 · Simple | Reads top to bottom without effort. |
| 6–10 · Moderate | Some nesting; manageable with clear naming. |
| 11+ · Complex | Deeply nested or tangled. A strong signal to simplify. |
A file can look fine on cyclomatic complexity but still score high here. That usually means the logic is nested rather than just plentiful - and flattening it will make the file much easier to live with.
Risk score
Where should I look first?
Risk is the tie-breaker. It blends the scores above with the file’s size and duplication into one signal, shown as a colored Low / Medium / High badge next to the filename. It answers a single question: does this file need attention?
| Badge | What it means |
|---|---|
| Low | Nothing to worry about. |
| Medium | Worth monitoring; a good candidate for scheduled cleanup. |
| High | Prioritize for review or refactoring. |
Risk is guidance, not a target. You don’t fix it directly - you fix what’s behind it. Improve a file’s maintainability or untangle its complexity, and its risk eases on the next scan. Its job is simply to point you at the files that need a closer look, so you’re not guessing where to spend your time.