CodeQL documentation

Lines of commented-out code in files

ID: py/lines-of-commented-out-code-in-files
Kind: treemap
Precision: high
   - 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.


In the following example, a print statement, originally used for debugging, is left in the code, but commented out. It should be removed altogether.

def area(r):
    #if DEBUG:
    #   print("Computing area of %r" % r)
    return r.length * r.width