A few years back, when we were full in the development of SQO-OSS, we built a prototype that calculated simple size metrics for a project, based on sloccount. Back then, I thought (I was much into Software Quality back then) that it would be interested to have a Java implementation of this tool, to better integrate with the SQO-OSS architecture, which was built on the JVM platform.
I built back then, a simple utility named JSLoCCount, which calculated SLoC (Source Lines of Code), CLoC (Comment Line of Code) for many programming languages. In addition, it also provided a simple report with counters for each file type, recognizing the most popular file types based on their extensions.
I recently decided to revive this old project, and make it available on github. It is used simply by executing the following command:
java -jar jsloccount <directory>
The utility produces a print out of the SLoC and CLoC for the project, categorised by language and a file popularity report. Both reports are saved in two CSV files, in current working directory. For example, the reports for JSLoCCount itself, will look like:
Number of Files: Java Compiled Class File, 14 / 30 Java, 11 / 30 JAR, 1 / 30 ANT Build File, 1 / 30 Other, 3 / 30 Number of Lines (comments): Java, 544 (89) ANT Build File, 24 (2)
and the two CSV files:
Resource Type,Source Lines of Code,Comments Lines of Code Java,544,89 ANT Build File,24,2
and
Resource Type,File Count,Total File Count Java Compiled Class File,14,30 Java,11,30 JAR,1,30 ANT Build File,1,30