Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse count lines of code [closed]

I've tried the Metrics plugin and although it's nice and all, it's not what my boss is looking for. It counts a line with just one } as a line and he doesn't want that to count as "its not a line, its a style choice". I also need to generate some form of report about the metrics provided. Are there any good tools for this?

like image 506
confusified Avatar asked Aug 03 '11 09:08

confusified


People also ask

How do I count the number of lines in a Java project?

After installation: - Right click on your project - Choose codepro tools --> compute metrics - And you will get your answer in a Metrics tab as Number of Lines. This one is actually quite good!

How do I show line numbers in eclipse?

Go to Window > Preferences > General > Editors > Text Editors and select the option Show line numbers as shown below. After this step, you can see that line numbers appear for the source code as shown.

How do I find line of code?

To use cloc simply type cloc followed by the file or directory which you wish to examine. Now lets run cloc on it. As you can see it counted the number of files, blank lines, comments and lines of code. Another cool feature of cloc is that can even be used on compressed files.


1 Answers

There's always the "brute force":

  1. Search->File

  2. Type the following in "Containing text" -> ^.*$. Then check the "Regular Expression" checkbox

  3. Type the following in "File name patterns" -> *.java

  4. Click "Search"

  5. Check the number of matches in the "Search" Tab.

like image 140
Christian Avatar answered Sep 30 '22 10:09

Christian