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.
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%UnverifiedWhen AI models generate code, they lack persistent memory of the overall architecture and tend toward local patching rather than global refactoring in each iteration, causing cyclomatic complexity and coupling to continuously rise.
60%UnverifiedIn the industry, a cyclomatic complexity of 10 is generally considered a warning threshold, and exceeding 20 is considered to make code difficult to maintain and test.
60%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%