How to read a code health score
A single letter grade is convenient, but it's only useful if you know what's actually being measured underneath it. Here's exactly what goes into REPO-SIGHT's health score, in the same weights the analyzer uses.
The five components
Each component is scored on a 0–100 scale by comparing your project's value against a "good" reference point and a "bad" reference point, then the five scores are combined by weight:
- Complexity density — 35%. Total cyclomatic complexity relative to lines of code. This is the single largest factor: a project can have plenty of code, but if a large share of it is branchy decision logic, the score drops fastest here.
- Average function length — 25%. Shorter, focused functions score higher than long ones that try to do several things at once.
- Comment coverage — 20%. The share of lines that are comments. Too little makes intent hard to recover later; the scoring rewards a healthy middle ground rather than maximizing comments for their own sake.
- TODO density — 10%. How often
TODO/FIXME-style markers show up relative to code volume — a proxy for acknowledged, unfinished work. - Max nesting depth — 10%. How deeply blocks nest inside each other. Deep nesting is a strong readability signal independent of raw complexity count.
The grade thresholds
The five weighted components sum to one overall score out of 100, which maps to a letter grade:
- A — 90 and above
- B — 80 to 89
- C — 70 to 79
- D — 60 to 69
- F — below 60
What to fix first on a low grade
Because complexity density carries the most weight, it's usually the highest-leverage place to start. In practice that means:
- Sort functions by cyclomatic complexity and look at the top few outliers first, rather than trying to fix everything at once.
- Check average function length alongside complexity — the two often move together, since a long function usually accumulates branches as it grows.
- Look at max nesting depth on the same hotspot functions; flattening nested conditionals frequently improves both the nesting and complexity components at the same time.
- Treat comment coverage and TODO density as secondary clean-up, not the first fix — they carry less weight and rarely explain a genuinely low grade on their own.
A score is a starting point for triage, not a verdict on the whole codebase. A project graded C can still be well-designed with a couple of legitimately complex algorithms; a project graded A can still have logic bugs the metrics can't see. Use the grade to find where to look, then read the actual code.
REPO-SIGHT computes this score automatically for any public C++, Python, or Java repository. Paste a GitHub URL to see your own grade and hotspot list.