I wanted to count the number of lines of code for java /jsp/ javascript etc files in my project. Unix word count (wc) tool could have given me the results with some amount of scripting, but thought let me search for some open source tool which gives results in graphical format. Quick search resulted in this neat tool called CLOC – Count Lines of Code.

I really liked the tool - because

  • Usage is simple
  • Very fast
  • Neat report - gives results categorized by file types like java/javascript/css etc

Giving below sample result from the tool -

http://cloc.sourceforge.net v 1.51  T=2.0 s (52.0 files/s, 6020.0 lines/s)

-------------------------------------------------------------------------------

Language                     files          blank        comment           code

-------------------------------------------------------------------------------

Java                            47            782            793           3724

Javascript                      18            115            525           2427

CSS                              8            118             48           1453

JSP                             23             47             20           1286

XML                              6            103             21            569

HTML                             2              0              0              9

-------------------------------------------------------------------------------

SUM:                           104           1165           1407           9468

-------------------------------------------------------------------------------