Cyclomatic Complexity
A code complexity metric introduced by Thomas McCabe in 1976. It measures the number of independent execution paths through a program, and it is generally recommended that a single function not exceed a cyclomatic complexity of 10.
Core Facts
Cyclomatic Complexity was proposed by Thomas McCabe in 1976 to measure the complexity of a program's control flow.
Cyclomatic complexity was proposed by Thomas McCabe in 1976, calculated as M = E - N + 2P, and the industry typically sets the upper limit of cyclomatic complexity for a single module at 10–15.
The industry generally considers that a cyclomatic complexity exceeding 10 for a single function requires refactoring
Timeline (last 90 days)
Cyclomatic complexity only counts control flow branches and is completely insensitive to data coupling, naming quality, and whether the level of abstraction is appropriate.
Cyclomatic Complexity, proposed by Thomas McCabe in 1976, quantifies code complexity by counting the number of independent execution paths in the code.
Software engineering generally recommends that the cyclomatic complexity of a single function not exceed 10.
Commonly used metrics for code quality assessment include cyclomatic complexity, code duplication rate, unit test coverage, and whether SOLID principles are followed.
Cyclomatic complexity was proposed by Thomas McCabe in 1976, calculated as M = E - N + 2P, and the industry typically sets the upper limit of cyclomatic complexity for a single module at 10–15.
All Facts (10)
Cyclomatic Complexity was proposed by Thomas McCabe in 1976 to measure the complexity of a program's control flow.
80%VerifiedCyclomatic complexity was proposed by Thomas McCabe in 1976, calculated as M = E - N + 2P, and the industry typically sets the upper limit of cyclomatic complexity for a single module at 10–15.
65%VerifiedThe industry generally considers that a cyclomatic complexity exceeding 10 for a single function requires refactoring
65%Unverified通常认为圈复杂度超过10的函数需要重点关注,超过20则属于高风险代码
85%Unverified圈复杂度业界通常以10为警戒线,超过20则认为代码难以维护和测试
85%UnverifiedCyclomatic complexity only counts control flow branches and is completely insensitive to data coupling, naming quality, and whether the level of abstraction is appropriate.
50%UnverifiedCyclomatic Complexity, proposed by Thomas McCabe in 1976, quantifies code complexity by counting the number of independent execution paths in the code.
50%UnverifiedSoftware engineering generally recommends that the cyclomatic complexity of a single function not exceed 10.
50%UnverifiedCommonly used metrics for code quality assessment include cyclomatic complexity, code duplication rate, unit test coverage, and whether SOLID principles are followed.
50%UnverifiedAI模型生成代码时缺乏对整体架构的持久记忆,每次迭代倾向于局部打补丁而非全局重构,导致圈复杂度和耦合度不断攀升
50%