How to calculate line count for project
- by sixtyfootersdude
I am taking a software engineering class right now. Our assignment is to evaluate Mozilla's Thunderbird. Our assignment is to evaluate the size of Thunderbird. One metric that we need to use is the number of lines of code in the project. (Lines of code meaning not including comments or new lines).
Is there a standard way to find the number of lines or am I better off just cracking out a script to do this?
I think that I could do something like this:
# remove all comments
find -name *.java | \
sed "/\/*/,\*\// s/.*//g | \ # remove multiline comments
sed s/\/\///g # remove single line comments
# count not empty lines
find -name *.java | grep -c "<character>"
But I would need to do that for each file type. It seems like there should be some utility that does that already. (something mac/unix compatible would be preferable).