ranking Sort Sort   |   date Sort Sort   |   member Sort Sort
Syndication

7
Date Submitted Thu. Sep. 14th, 2006 1:45 PM
Revision 1
Helper dohpaz
Tags bash | Code | Comments | Grep | Sed
Comments 1 comments
I found this script online, and decided that I would modify it for my needs. As a developer, I like to know how many actual lines of code I have written--not including any comments.

It outputs in a very simple way:

Including Comments: NNN
Without Comments: NNN

One very practical, and quick, way to determine how many lines of code a project has is to pipe it through a find:


find /usr/share/php -name "*.php" -o -name "*.inc" | xargs count-code


If your code is in files of another type (i.e., .c, .h, .cpp, etc), then simply change the extensions and add more '-o -name "*.ext"' tags. If you have directories that you don't want to be counted, simple throw a "| grep -v [path/to/excluded/directory] |" inbetween the find and the xargs, and they will not be counted.