Forums : Ohloh General Discussion

Dear Open Hub Users,

We’re excited to announce that we will be moving the Open Hub Forum to https://community.blackduck.com/s/black-duck-open-hub. Beginning immediately, users can head over, register, get technical help and discuss issue pertinent to the Open Hub. Registered users can also subscribe to Open Hub announcements here.


On May 1, 2020, we will be freezing https://www.openhub.net/forums and users will not be able to create new discussions. If you have any questions and concerns, please email us at [email protected]

How is ohloh counting lines

Hi,

The analyses page for jUnit presents a Java lines of code count of 12849.
However I counted (using wc) the (all) lines in java files for junit-4.8.1-src.jar and got 10855 lines (11074 lines for junit4.8.1.zip).

I find it strange that there are more lines of code than lines...
Can anyone explain this mismatch?

Thanks in advance.

Cheers,
Miguel

MiguelFerreira about 15 years ago
 

Hi Miguel,

Ohloh counts code using Ohcount, an open source code counter.

Ohloh does not analyze JARs or zip files or any other type of static snapshot. We only work directly against the source control repository.

There is plenty of Java code in the CVS repository to account for Ohloh's numbers:

~$ cvsnt -d :pserver:anonymous:@junit.cvs.sourceforge.net:/cvsroot/junit co junit
~$ find junit -name '*.java' | xargs cat | wc -l
18365

I am not familiar with the details of this project, but it is likely that not all of the code in the CVS repository is delivered in the JAR.

Robin Luckey about 15 years ago
 

Hi Robin,

Thanks for the explanation.
I'm going to try to discover which files are being left out from the distribution.

EDIT: the difference in the numbers is due to the test code that you get from the repository checkout.

Cheers,
Miguel

MiguelFerreira about 15 years ago
 

Hi again,

I noticed that HSQLDB Code Metrics page state that the project amounts to almost 6M LOC of java (12M in total lines).

However, this figure seems awfully large.
So I checked the code base out from SF (base-2.0.0-rc8, dotnet-HEAD and odbc-HEAD) and ran a line count.

$ svn export https://hsqldb.svn.sourceforge.net/svnroot/hsqldb/base/tags/2.0.0-rc8/ base-2.0.0-rc8

$ svn export https://hsqldb.svn.sourceforge.net/svnroot/hsqldb/dotnet/trunk/ dotnet

$ svn export https://hsqldb.svn.sourceforge.net/svnroot/hsqldb/odbc/trunk/ odbc

$ find . -type f -iname '*.java' | xargs wc - l

The result (in lines) was:
442127 total

Might it be the case that the 12M lines of code are calculated over the entire repository, which contains several tags?

Cheers,
Miguel

MiguelFerreira about 15 years ago
 

tags directories should never be added to Ohloh.

You are correct: Ohloh will include each tag directory in the line count, and this will lead to grossly inflated results.

If this repository URL includes tags and branches -- and it appears that it does -- then it should be removed from Ohloh, and it should be replaced with individual URLs to specific trunks.

Robin Luckey about 15 years ago
 

Ok. That explains it.

Glad I could help.
Miguel

MiguelFerreira about 15 years ago