scitools.com

← Metric catalog

Executable Statements 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.

Executable Statements

API ID: CountStmtExe
Languages: Ada, Assembly, Basic, C#, C++, Fortran, Java, Jovial, Pascal, Python, VHDL, Web
Targets: Architectures, Classes, Files, Functions, Modules, Packages, Project, Subprograms

Number of executable statements.

A statement that both declares a variable and initializes it with a function call counts as both executable and declarative.

For example:


int main() {
  for (int i = 0;
       i < 10;
       i++)
    ;

  int j = func();
  int k = 0;
  int l = 1;

  int m
    = func();
  int n;
  n = 1;

#ifdef A_VERY_NICE_VARIABLE

  int j = 0;
  cout << j << endl;
#endif

  return 0;
}

The for loop's condition (i < 10) and increment (i++) clauses, the two initializations that call func() (int j = func(); and int m = func();), n = 1;, and return 0; are all executable, for CountStmtExe = 6.

See Declarative Statements for the complementary breakdown, and Statements for the total. For the per-language breakdown in web files, see Executable Statements (JavaScript) and Executable Statements (PHP).


Targets By Language: Configuration: