Do you find cyclomatic complexity a useful measure?

后端 未结 15 1305
傲寒
傲寒 2020-12-12 22:03

I\'ve been playing around with measuring the cyclomatic complexity of a big code base.

Cyclomatic complexity is the number of linearly independent paths through a pr

15条回答
  •  没有蜡笔的小新
    2020-12-12 22:33

    We refactor mercilessly, and use Cyclomatic complexity as one of the metrics that gets code on our 'hit list'. 1-6 we don't flag for complexity (although it could get questioned for other reasons), 7-9 is questionable, and any method over 10 is assumed to be bad unless proven otherwise.

    The worst we've seen was 87 from a monstrous if-else-if chain in some legacy code we had to take over.

提交回复
热议问题