Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SLOC for Java projects

Tags:

java

metrics

I neeed a free tool to count SLOC on a Java project. I only really need the following metrics:

  • SLOC
  • number of comment lines
  • optionally javadoc metrics
  • optionally sort statistics by file type (.java, .js, .css, .html, .xml, etc)

Bonus:

  • 100% Java, I don't like mix something like sloccount with cygwin
  • netbeans plugin
  • or preferably, maven plugin
like image 390
dfa Avatar asked Feb 02 '10 15:02

dfa


2 Answers

Did you consider using Sonar (which uses its own internal tool since version 1.9, sonar-squid, instead of JavaNCSS which has some flaws and doesn't work well with Java 1.5 or 1.6 projects)? This is the kind of report you'll get:

alt text http://sonar.codehaus.org/wp-content/uploads/2009/05/sonar-squid.jpg

Sonar does a lot more than just collecting SLOC though, maybe not what you want.

like image 148
Pascal Thivent Avatar answered Oct 20 '22 07:10

Pascal Thivent


My advice is don't.

You get what you measure for.

If you reward big LOC, you'll get a lot of LOC.

If you reward small LOC, you'll get perl.

like image 27
Will Avatar answered Oct 20 '22 09:10

Will