scitools.com

← Metric catalog

Average 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.

Average Essential Complexity

API ID: AvgEssential
Languages: Ada, Basic, C#, C++, Fortran, Java, Jovial, Python, Rust, Web
Targets: Architectures, Classes, Files, Modules, Packages, Project

Average Essential complexity for 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 average is (1 + 3) / 2 = 2, exactly. For the whole file (sample.cpp), the average is (1 + 3 + 1 + 1) / 4 = 1.5, rounded to 2.

See Sum and Max Essential Complexity for the other aggregations.


Targets By Language: Configuration: