代码的环复杂度(Cyclomatic complexity,有的地方又翻译成圈复杂度)是一种代码复杂度的衡量标准,在1976年由Thomas J. McCabe, Sr. 提出。 在软件测试的概念里,圈复杂度用来衡量一个模块判定结构的复杂程度,数量上表现为独立线性路径条数,即合理的预防错误所需测试的最少路径条数。圈复杂度大说明程序代码可能质量低且难于
Kraft N. Ward C., Cyclomatic complexity and lines of code: Empirical evidence of a stable linear relationship, Journal of Software Engineering and Applications (2009).Jay 2009] Jay, Graylin et al. Cyclomatic Complexity and Lines of Code: Empirical Evidence of a Stable Linear Relationship. ...
This metric calculates the number of decision points in a function and adds one to the total. A decision point is a statement that causes your program to branch into two paths. The recommended upper limit for this metric is 10. If the cyclomatic complexity is high, the code is both diffic...
具体步骤参考我的ABAP博客: A Small tip to get all transparent tables used in ABAP code Useful tips regarding ABAP code inspector that you may not know 而Java可以用一个叫做SourceMonitor的工具测量环复杂度: 详细使用参考我的博客Use SourceMonitor to monitor your java code complexity...
There is some basic truth to the idea that the more lines of code in a function, the more likely it is to have errors. However, when you combine cyclomatic complexity with lines of code, then you have a much clearer picture of the potential for errors....
And when you understand your codebase, this goes a long way in enhancing its quality and maintainability.Cyclomatic complexity is a quantitative measure of a computer program's complexity used in computer science. In essence, it reflects the number of linearly independent paths through a program's...
In fact, cyclomatic complexity provides no new information in predicting bugs than the size of the method (or file or other unit of measure). Well-designed code will be both more concise and have fewer conditionals. Therefore, in comparison to the easier-to-collect “number of lines of code...
A commonly accepted ideal limit to complexity in a given chunk of code is 10. That is, code that has a measured complexity of 10 or less is easy to understand, maintain, debug and modify. In my own experience, a complexity value of up to 20 is pretty workable (and sometimes unavoidable...
Programs with higher complexity are more open to errors and are difficult to test and maintain. On the other side, programs with lower complexity are very easy to understand, test, and modify. Basically cyclomatic complexity helps in identifying which areas of the code need more testing or a...
Tool for calculating cyclomatic complexity of a JavaScript and TypeScript code.. Latest version: 1.2.5, last published: 8 months ago. Start using cyclomatic-complexity in your project by running `npm i cyclomatic-complexity`. There are no other projects