0

Sloccount is great package to use when you have a directory and group of directories that you want to have sloccount of . You get output such as this -

Computing results.


SLOC    Directory   SLOC-by-Language (Sorted)
64535   top_dir         cpp=60050,sh=4346,objc=123,sed=16


Totals grouped by language (dominant language first):
cpp:          60050 (93.05%)
sh:            4346 (6.73%)
objc:           123 (0.19%)
sed:             16 (0.02%)




Total Physical Source Lines of Code (SLOC)                = 64,535
Development Effort Estimate, Person-Years (Person-Months) = 15.90 (190.76)
 (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months)                         = 1.53 (18.39)
 (Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule)  = 10.37
Total Estimated Cost to Develop                           = $ 2,147,468
 (average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
redistribute it under certain conditions as specified by the GNU GPL license;
see the documentation for details.
Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."

But it fails completely when you try to use a .deb package or an .tar.gz archive. Is there another package which can do this without trying to figure switches for it ?

[$] sloccount debdelta_0.55.tar.gz                                                                                          
Have a non-directory at the top, so creating directory top_dir
Adding /home/shirish/games/debdelta_0.55.tar.gz to top_dir
Categorizing files.
Computing results.


SLOC    Directory   SLOC-by-Language (Sorted)
0       top_dir         (none)
SLOC total is zero, no further analysis performed.

OR

[$] sloccount i-nex_7.6.0_amd64.deb                                                                                                
Have a non-directory at the top, so creating directory top_dir
Adding /home/shirish/games/i-nex_7.6.0_amd64.deb to top_dir
Categorizing files.
Computing results.


SLOC    Directory   SLOC-by-Language (Sorted)
0       top_dir         (none)
SLOC total is zero, no further analysis performed.
  • For the tar.gz case, you simply don't want to bother doing the unpacking yourself, is that correct? – Michael Kohne Jan 31 '17 at 18:37
  • For the deb case, most deb files that have an architecture like that consist mostly of binaries. So even if you got sloccount to unpack the deb archive into it's parts, most of those parts are likely to be compiled programs, which sloccount isn't able to do anything with. – Michael Kohne Jan 31 '17 at 18:39
  • correct as I have many .tar.gz files and unpacking them, using sloc and removing them all takes time. With .deb packages it's all the more difficult as the files get distributed all over the system. – shirish Jan 31 '17 at 18:39
  • @MichaelKohne that may be true but I would like to try and see what happens. I have a few packages which are just scripts so sloccount should be able to give output provided it is able to decompress it in memory and show me just the output. It is possible that there may be a package which does this precisely . – shirish Jan 31 '17 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.