scitools.com

← Metric catalog

Comment 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.

Comment Lines (Includes Inactive)

API ID: CountLineCommentWithInactive
Languages: C++
Targets: Architectures, Classes, Files, Functions, Project

Number of lines containing a comment, including inactive regions.

Unlike Comment Lines, this counts a comment line whether or not it falls inside an inactive region.

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

}

Both the default: // a comment here line and the // Inactive comment on the cout line inside the #ifdef block count, for CountLineCommentWithInactive = 2.

See Comment Lines to exclude inactive comments.


Targets By Language: Configuration: