What .. is your favourite SLOC counter?
Is this a good question? I would say it is something that could be asked by the bridgekeeper in the film Monty Python and the Holy Grail. In our research group we started using sloccount a long time ago and it is currently integrated with some of our data mining tools like cvsanaly but after testing ohcount a couple of times during the last summer I started to though we should either improve it or replace it. Yesterday I read a post by Nicolas Betternburg on a study of PostgreSQL 9 and he mentioned he used cloc to count the SLOC (source lines of code) so I decided to test a couple of tools during this cold morning in Madrid.
The test I performed use the latest code of fusionforge and nautilus with the aim of getting the total SLOC and the SLOC for the primary language. I started with the tools cloc 1.09, sloccount 2.26 and ohcount (latest from git), but I obtained weird results from ohcount (very different from the version used in ohloh) and I discarded it. This is what I got:
SLOC in Fusionforge:
- 452508 in 27 different languages according to cloc
- 285193 in 10 different languages (javascript is not among them!) according to sloccount
Primary language in Fusionforge (PHP SLOC):
- 244435 according to cloc
- 243355 according to sloccount
SLOC in Nautilus:
- 182967 in 10 different languages according to cloc
- 146595 in 5 different languages according to sloccount
Primary language in Nautilus (C SLOC):
- 134675 according to cloc
- 134680 according to sloccount
There are other SLOC counters but they are not available in the Debian repos .. those are: sclc, USC’s CODECOUNT and loc
At this point I think we should test deeply cloc but I still don’t understand some numbers in the fusionforge report where it says there are 1600 PHP files and using the “file” command I only found 1355.
So .. the good think of sloccount is the time and effort estimation (but it is based on the SLOC), the great feature of ohcount is to identify the FLOSS licenses of the code and as far as I’ve seen the best SLOC counter is cloc. Do you agree?
[This post is also available in my blog at libresoft.es]
