How to count lines of code in a PHP project?

Wednesday, November 4, 2015

I'd like to count the the lines of code of a PHP-project in a given git repository. Currently I'm using:



git ls-files -- *.php* | xargs wc -l


to count the lines of code in all php files.



It would be great to have a step before counting all lines, that skips all empty lines and maybe also lines containing comments (in PHP this in # and // for single line comments and /* */ for multiline comments). I guess sed might help, but how to handle multiline comments?

0 comments:

Post a Comment