Ever wonder just how many lines of code are in the project you’re working on? If you’re not already familiar with it, the appropriately named CLOC (Count Lines of Code) does just that. I don’t recall how I originally came across this tool, though I suspect it was the result of a google search on a day when curiosity got to me. CLOC is a command line tool, it’s simple to use, supports a ton of languages, and it’s configurable.
Example:
$ perl cloc-1.56.pl 'path to project'
344 text files.
333 unique files.
111 files ignored.
http://cloc.sourceforge.net v 1.56 T=2.0 s (134.0 files/s, 13006.5 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Objective C 124 4244 2400 13570
C/C++ Header 144 1344 2186 2269
-------------------------------------------------------------------------------
SUM: 268 5588 4586 15839
-------------------------------------------------------------------------------
If you want to do deeper analysis, CLOC will output results directly to a sqlite database. You can download CLOC here.
Have other tools that you like to use for this type of code analysis? Please leave a comment below.