Clarifying the manual count of Cyclomatic Complexity

痴心易碎 提交于 2019-12-02 00:29:29

As we know, CC = P+1.

Here, P = number of predicate nodes (conditions) = 2

Number of conditions will be 2 because:

Case branch can cover several alternative values or ranges, such as Case 1, 2, 5 To 10. As they introduce no additional branches to decide on, they do not increase cyclomatic complexity either.

source: here

So, CC = 2+1 = 3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!