scitools.com

← Metric catalog

Sum Modified 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 Modified Cyclomatic Complexity

API IDSumCyclomaticModified
TargetsArchitectures Classes Files Functions Modules Packages Project Subprograms
LanguagesAda Basic C# C++ Fortran Java Jovial Pascal Python Rust Web
AggregationSum
CategoriesComplexity
CostQuery
CyclomaticModified
SuitesMcCabe

Sum of modified 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 Modified Cyclomatic Complexity of 1, 3, 8, and 2. func() is only declared, not defined, so it isn't counted. For the SayHello class, the sum is 1 + 3 = 4. For the whole file (sample.cpp), the sum is 1 + 3 + 8 + 2 = 14.

See Max and Average Modified Cyclomatic Complexity for the other aggregations.


Targets By Language: