By Arjun Mehta
In most engineering organizations, code quality is treated like the weather. Everyone talks about it, but nobody measures it.
You can't manage what you don't measure.
Here are the metrics that matter.
Cyclomatic Complexity
Measures the number of decision points in code. High complexity means the function is hard to test, modify, and understand.
Target: Average complexity < 10. Functions > 15 are red flags.
Code Duplication
When the same logic appears in multiple places, it multiplies maintenance burden. Change it once? You need to find and change it everywhere.
Target: < 5% duplication. > 10% is a red flag.
Test Coverage
What percentage of code is tested? This is a proxy for quality, not a guarantee.
Target: > 80% on critical paths. < 50% on anything is risky.
Dependency Depth
How many layers deep is your codebase? In tightly coupled systems, changing one component ripples through five others.
Target: Moderate depth (3-5 layers). > 8 is a red flag.
Stale Code
Code that hasn't been touched in 2+ years is dead weight. It's not generating value, it's consuming maintenance overhead.
Target: < 10% of codebase should be untouched for 2+ years.
Technical Debt Age
Not all debt is equal. A 3-month-old shortcut being paid down is fine. A 3-year-old workaround spawning more workarounds is dangerous.
Target: No debt older than 6 months without a plan to fix it.
Putting It Together
Track these metrics together:
- Complexity hotspots
- Duplication concentration
- Coverage gaps
- Dependency risk
- Stale code volume
- Debt age
These tell the real story. They show where your team is spending extra cycles, where bugs hide, where features take longer.
Glue automatically surfaces these metrics from your codebase. No instrumentation. No process changes. Just insight.
Frequently Asked Questions
Q: Should we set hard thresholds for these metrics?
No. Hard thresholds cause perverse incentives. Use metrics as conversation starters. "This function has 15 complexity. Let's discuss if that's correct."
Q: How often should we review metrics?
Monthly. More frequently is noise. Less frequently and you miss trends until they're problems.