Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Count number of lines of code and comments in scala codebases
branch: master


This is an Awk script copied from originally written to compute C code metrics and modified to calculate nested comments as in Scala. It looks at code and comments via regular expressions and computes:

  • Lines of code (non-blank)
  • Number of comments (multiline and single-line accounted for)
  • Raw lines of text
  • Total code
  • Total comments
  • Comment percentage


Run it like so:

awk -f lc.awk $(find /project/dir -name "*.scala")
Something went wrong with that request. Please try again.