Ohcount and Count Lines of Code (CLOC) counts size of code project. Mostly these aren’t very useful applications, but it is fun to see that I have written 300 lines of code in couple of days.
Ohcount is used Ohloh to generate source code reports. I was disappointed to found that i can’t use Ohcount to scan whole history of my repository, it only scans current status of code.
CLOC is written in Perl and Ohcount in Ruby. It maybe little annoying to compile Ohcount from source, but it is much faster than CLOC. If you want something that is easy to install, take CLOC. But if you are going to analysis more often than once, try Ohcount.
Here is example output from CLOC:
96 text files.
83 unique files.
33 files ignored.
http://cloc.sourceforge.net v 1.08 T=7.0 s (8.9 files/s, 547.4 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code scale 3rd gen. equiv
-------------------------------------------------------------------------------
PHP 49 588 172 1950 x 3.50 = 6825.00
SQL 1 58 87 277 x 2.29 = 634.33
BASH 10 54 133 261 x 3.81 = 994.41
CSS 1 46 5 192 x 1.00 = 192.00
Python 1 2 1 6 x 4.20 = 25.20
-------------------------------------------------------------------------------
SUM: 62 748 398 2686 x 3.23 = 8670.94
-------------------------------------------------------------------------------
And here is Ohcounts output from same file:
Examining 555 file(s)......
Ohloh Line Count Summary
Language Files Code Comment Comment % Blank Total
---------------- ----- --------- --------- --------- --------- ---------
php 58 2146 219 9.3% 716 3081
sql 1 277 87 23.9% 58 422
html 60 242 1 0.4% 38 281
css 1 192 5 2.5% 46 243
python 1 6 1 14.3% 2 9
---------------- ----- --------- --------- --------- --------- ---------
Total 121 2863 313 9.9% 860 4036
- Gestalts -------------------------------------------------------------------
Platforms: PHP, SQL, Scripting
Yep. There is some difference on results. I don’t know which one is more accurate.
I haven’t posted for a while because I have coded my main project. It isn’t public, but I will blog about it when it is ready.
I try to blog more often.


