具有多个出口点的代码的循环复杂度 [英] Cyclomatic complexity of a code with multiple exit points

查看:86
本文介绍了具有多个出口点的代码的循环复杂度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找到具有多个出口点的函数的圈复杂度?
Wiki页面上说
p-s + 2,其中p是决策点数,s是退出点数。

How to find the cyclomatic complexity of a function with multiple exit points? The wiki page says p-s+2 where p is the number of decision points and s is the number of exit points.

但是更多出口点是否不应该增加环行复杂性,因为它可能导致更独立的路径?

But should not more exit points increase the cyclomatic complexity as it may lead to more independent paths?

干杯,

阿曼

推荐答案

为什么不尝试 NDepend ?它将计算圈复杂度和许多其他代码指标。

Why not try a trial of NDepend? It will calculate cyclomatic complexity and many other code metrics.

这篇关于具有多个出口点的代码的循环复杂度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆