scitools.com

← Metric catalog

Average Blank Lines (Includes Inactive) 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 Blank Lines (Includes Inactive)

API ID: AvgCountLineBlankWithInactive
Languages: C++
Targets: Classes, Files

Average number of blank lines for all nested functions or methods, including inactive regions.

Unlike Average Blank Lines, this counts each function's blank lines inside inactive #if/#ifdef regions too, before averaging. Only functions and methods that are actually defined (not just declared) directly inside the container count towards the average, and the result rounds to the nearest whole number.

For example:


class SayHello {
public:
  SayHello() {}
  void printHello();
};

void SayHello::printHello() {
  ...
}

void cyclomaticDemo() {
  ...
}

int func();
int main() {
  ...
}

SayHello() has 0 blank lines (including inactive) and SayHello::printHello() has 2 (one of its blank lines falls inside an inactive #ifdef block), so class SayHello's average is Average(0, 2) = 1. The file also includes cyclomaticDemo() (2) and main() (5, which also has an inactive blank line): Average(0, 2, 2, 5) = 2.25, which rounds to 2.

See Blank Lines (Includes Inactive) for the per-function count this averages.


Targets By Language: Configuration: