java - 圈复杂度和变体

标签 java metrics cyclomatic-complexity

本质复杂度、设计复杂度、扩展圈复杂度、圈复杂度之间有什么区别?

我正在使用 IntelliJ IDEA 插件检查此指标。

enter image description here

最佳答案

概览

设计复杂度衡量一种方法对其他方法的依赖性; 圈复杂度 衡量通过一种方法的不同路径的数量; 扩展圈复杂度添加了一个控制逻辑度量来表示“完全执行方法控制流所需的最少测试次数。”

详情

Design complexity

This metric reports the design complexity of a method. The design complexity is related to how interlinked a method's control flow is with calls to other methods. Design complexity ranges from 1 to V(g), the cyclomatic complexity of the method. Design complexity also represents the minimal number of tests necessary to exercise the integration of the method with the methods it calls.

Cyclomatic complexity

This metric reports the cyclomatic complexity of each non-abstract method. Cyclomatic complexity is a graph-theoretic measure of the number of distinct paths through each method. In practice, it is basically 1 + the number of branch points in the method.

Extended cyclomatic complexity

This metric reports the extended cyclomatic complexity of each non-abstract method. Cyclomatic complexity is a graph-theoretic measure of the number of distinct paths through each method, augmented by a measure of the complexity of the decision points. In practice, it is basically 1 + the number of branch points in the method plus the number of logical 'and' and 'or' operations. Cyclomatic complexity also represents the minimal number of tests necessary to completely exercise a method's control flow.

关于java - 圈复杂度和变体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27954015/

相关文章:

java - 通过id获取组件的值?

Java 8 将给定时间和时区转换为 UTC 时间

java - Sonar如何计算圈复杂度?

Java jface 从相对位置调用浏览器

java - 在哪里可以找到 Java 构造函数中的技术规范重载抽象方法?

python - 如何使用时间字段将指标数据添加到 influxdb?

metrics - Linux工具显示SLOC和SLOC修改、添加、删除

java - 计算方法的字节码大小

python - Python 的圈复杂度度量实践

ios - 如何找到 Xcode 项目的圈复杂度?