How to calculate line count for project

Posted by sixtyfootersdude on Stack Overflow See other posts from Stack Overflow or by sixtyfootersdude
Published on 2010-05-31T14:20:30Z Indexed on 2010/05/31 14:22 UTC
Read the original article Hit count: 706

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).

© Stack Overflow or respective owner

Related posts about homework

Related posts about software-engineering