SourceMonitor 中用于计算复杂性的参数是什么?
我最近开始使用 SourceMonitor 来检查我(和其他人)的代码。 虽然我了解该工具判断的其他参数,但我不知道它是如何计算代码的复杂度的。例如,它考虑读取复杂度数字的所有参数是什么?
I recently started using SourceMonitor to review my (and others) code.
Though I understand other parameters judged by the tool, I don't know how does it calculates the complexity of the code. As in, what all parameters does it considers to read to a complexity number?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发现它在
帮助->帮助主题 ->语言指标解释-> C#->最大方法复杂度 -> (有一个hyperling)复杂性值。
源监视器复杂度值 http://tinypic.com/r/10yi0kp/6
Found it in
Help -> Help Topics -> Explanation of language Metrics -> C# -> Max Method Complexity -> (There is a hyperling) Complexity Value.
Source Monitor Complexity Value http://tinypic.com/r/10yi0kp/6
如果没有他们的说明,很难知道,但最常见的衡量标准之一是圈复杂度 - 通过代码的路由数量的度量。一个简单的自上而下的过程方法的复杂度为 1,所有循环/分支/捕获等都会增加这一点。这个想法是,如果这个值增长得太高,那么你的方法就做得太多了,应该重构为一些更小、更有针对性的方法。
编辑; 从这里:
(强调我的)所以听起来他们有一个稍微修改过的常规 CC 变体。只有他们才能告诉你他们做了什么不同的事情;p
It is hard to know without them stating it, but one of the most common measures is cyclomatic complexity - a measure of the number of routes through code. A simple top-to-bottom procedural method has complexity 1, with all loops / branches / catches etc adding to this. The idea is that if this grows too high, your method is doing too much and should be refactored into a few smaller, more targetted methods.
Edit; from here:
(emphasis mine) so it sounds like they have a slightly modified variant of regular CC. Only they can tell you what they did different ;p