Count lines of code in Eclipse
When searching for how to count the lines of code I had in my project, I ran into this blog entry. While it’s a good start, it still gave me some inaccurate counts. I was getting inflated counts because of new lines. So, here is my alternate solution:
-
Open Eclipse and open your project
-
Click the Search menu and choose ‘file’
-
In the containing text box, enter “\w+\n” without quotes and then check the regular expression box.
-
In the file name patterns box, enter the extensions of all your source. I added .php,.phtml,.js,.html,.htm,.css
-
Make sure Workspace is selected and click search
The result will the number of matches found in the search panel. The regular expression makes sure that the new line has at least one or more non white space character.