Comment Lines (Includes Comments Before Functions) 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 Comments Before Functions)
API ID: CountLineCommentWithBeforeLanguages: Any
Targets: Functions
For functions, the number of comment lines inside the function (CountLineComment) plus comments before the function.
For example, the following function has a CountLineComment value of 2 for the two interior comments, but a CountLineCommentWithBefore value of 3 because the comment preceding the function also counts towards the comment lines.
// A comment before the function, does not count for CountLineComment
int doSomething()
{
// A comment inside the function, counts for both
return 0; // a comment on a line that is also a code line
}
See also RatioCommentsWithBeforeToCode.