Software Engineering · Code Quality
A numeric score counting every possible route through a function — each branch or loop adds one. The higher the score, the more paths there are to test and reason about.
Example: More if-statements and loops packed into one function means a higher score.
In practice: Many teams set a threshold — often around 10 — above which a function gets automatically flagged for refactoring during code review.
Debated: Critics argue it's a weak proxy for real complexity — a function with high cyclomatic complexity but simple, independent branches can be easier to reason about than a 'simple' function with deeply tangled shared state.