scitools.com

← Metric catalog

Blank Lines 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.

Blank Lines

Also Known AsBlank Lines of Code (BLOC)
API IDCountLineBlank
TargetsArchitectures Classes Files Functions Modules Packages Project Subprograms
LanguagesAda Assembly Basic C# C++ Fortran Java Jovial Pascal Python Rust VHDL Web
CategoriesLines
CostLookup
TagsProject Summary

Number of blank lines.

A line only counts if it is active.

For example:

void SayHello::printHello() {
  switch (i) {
    case 0:
      cout << "Hello World" << endl;
    case 1:
      cout << "HELLO WORLD!" << endl;
    default: // a comment here
      for (int m = 0; m < j; m++);
      cout << "hello world" << endl;
  }
#ifdef A_VERY_NICE_VARIABLE

  cout << "Inactive Line" << endl; // Inactive
#endif

}

Line 25, the blank line just before the closing brace, is the only blank active line. The blank line inside the #ifdef A_VERY_NICE_VARIABLE block (line 22) doesn't count because it's inactive, giving CountLineBlank = 1.

To also count blank lines inside inactive regions, use Blank Lines (Includes Inactive). For the per-language breakdown in web files, see Blank Lines (HTML), Blank Lines (JavaScript), and Blank Lines (PHP).

Also known as Blank Lines of Code (BLOC).


Targets By Language: