Sum Strict Cyclomatic Complexity is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Sum Strict Cyclomatic Complexity
| API ID | SumCyclomaticStrict |
| Targets | Architectures Classes Files Functions Modules Packages Project Subprograms |
| Languages | Ada Basic C# C++ Fortran Java Jovial Pascal Python Rust Web |
| Aggregation | Sum |
| Categories | Complexity |
| Cost | Query |
| Cyclomatic | Strict |
| Suites | McCabe |
Sum of strict cyclomatic complexity of all nested functions or methods.
For example:
class SayHello {
public:
SayHello() {}
void printHello();
};
void SayHello::printHello() {
switch (i) {
...
}
}
void cyclomaticDemo() {
...
}
int func(); // declared here, not defined - excluded from aggregates
int main() {
...
}
SayHello(), printHello(), cyclomaticDemo(), and main() have Strict Cyclomatic Complexity of 1, 4, 12, and 2. func() is only declared, not defined, so it isn't counted. For the SayHello class, the sum is 1 + 4 = 5. For the whole file (sample.cpp), the sum is 1 + 4 + 12 + 2 = 19.
See Max and Average Strict Cyclomatic Complexity for the other aggregations.
- Ada: Project, File, Type, Entry, Function, Package, Procedure, Protected, Task
- Basic: Project, File, Method, Module, Class, Struct
- C#: Project, File, Class, Struct, Method
- C++: Project, File, Class, Struct, Union
- Fortran: Project, File, Module, Function, Program, Subroutine
- Java: Project, File, Class, Interface, Method
- Jovial: Project, File
- Pascal: Project, File, Class, Interface, Compunit, Function, Procedure
- Python: Project, File, Class
- Rust: Project, File
- Web: Project, File, PHP Class, PHP Interface