Lines of commented-out code in files¶
ID: js/lines-of-commented-out-code-in-files
Kind: treemap
Severity:
Precision:
Tags:
- maintainability
Click to see the query in the CodeQL repository
This metric counts the number of lines of commented-out code in each file. Large amounts of commented-out code often indicate poorly maintained code.
Example¶
In the following example, a console.log
method call, perhaps originally used for debugging, is left in the code, but commented out. It should be removed altogether.
function area(r) {
// console.log("Got r: " + r);
return r.length * r.width;
}
References¶
Mark Needham: The danger of commenting out code.
Los Techies: Commented Code == Technical Debt.
High Integrity C++ Coding Standard: 2.3.2 Do not comment out code.