This metric measures the percentage of a file's lines that are comment rather than code.

A low percentage of comments in a file may indicate either a potentially worrying lack of documentation or that the file was generated by an automated tool. A quick visual inspection should be sufficient to distinguish between the two cases.

Files that were not auto-generated and have a low comment percentage should be documented more fully. Refer to [McConnell] for more on how to write good comments.

  • S. McConnell. Code Complete, 2nd Edition. Microsoft Press, 2004.