scitools.com

← Metric catalog

Executable Units 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 Units

API ID: CountDeclExecutableUnit
Languages: Ada, Basic, C#, Fortran, Java, Pascal, Python, Web
Targets: Architectures, Files, Project

Number of program units with executable code.

Counts local methods, functions, and similar callable units that actually have an implementation — not bare declarations, and not abstract/external/forward-declared ones.

For example:


public class sample {

  public void publicMethod() {
  }

  void defaultMethod() {
  }

  private void privateMethod() {
  }

}

class Helper {

  public int value;

  public void doWork() {
    value++;
  }

}

class Coupler {

  public void useHelper() {
    Helper h = new Helper();
    h.doWork();

    java.util.ArrayList<String> list = new java.util.ArrayList<String>();
    list.add("test");
    System.out.println(list.size());
  }

}

sample.java declares 5 concrete methods across its 3 classes — publicMethod, defaultMethod, and privateMethod (in sample), doWork (in Helper), and useHelper (in Coupler) — so CountDeclExecutableUnit = 5 for this file.

Targets By Language: Configuration: