Ask coding questions

← Back to all posts
Cyclomatic Complexity too high?
OwenBradstreet (81)

I know that Cyclomatic Complexity is the number of different routes the user can take through code after a certain point (correct me if I'm wrong), but how can it be too high? Python 3 says above 15 is too high - it doesn't seem to affect my code in any way, it's just annoying that it underlines code for no apparent reason.

Can someone explain this to me? Thanks.

amasad (1383)

Do you have an example? 15 does seem too high though (that means ~15 nested blocks?)

OwenBradstreet (81)

@amasad I don't have an example that wouldn't fill a page haha, but 15 or more nested if's yes (not all under one if statement, nested within eachother). Why is 15 too high though? As in, what disadvantage or issues does it cause?

ainain074 (0)

mine is 44 tho -_-