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.