Max Essential 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.
Max Essential Complexity
API ID: MaxEssentialLanguages: Ada, Basic, C#, C++, Fortran, Java, Jovial, Pascal, Python, Rust, Web
Targets: Architectures, Classes, Files, Modules, Packages, Project
Maximum essential 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 Essential Complexity of 1, 3, 1, and 1. func() is only declared, not defined, so it isn't counted. For the SayHello class, the maximum is 3. For the whole file (sample.cpp), the maximum is 3.
See Sum and Average Essential Complexity for the other aggregations.
- Ada: Project, File, Package
- Basic: Project, File, Module, Class, Struct
- C#: Project, File, Class, Struct
- C++: Project, File, Class, Struct, Union
- Fortran: Project, File
- Java: Project, File, Class, Interface
- Jovial: Project, File
- Pascal: Project, File, Class, Interface, Compunit
- Python: Project, File, Class
- Rust: Project, File
- Web: Project, File, PHP Class, PHP Interface
- For projects and architectures, this metric must also be enabled from "Project Configuration/Metrics/Projects and Architectures" with the "Show aggregated function metrics" option.
- This metric can be enabled from "Project Configuration/Metrics/Complexity" with the "Essential" option.