From: Johannes Baagoe on
Johannes Baagoe :

> It should be easy to add support for .js files:
> http://www.dwheeler.com/sloccount/sloccount.html#adding

It is. Just change compute_sloc_lang and break_filelist. (They are
scripts, no downloading of sources needed.)

If you call the language "javascript" or "ECMAScript", the length of the
name is going to play havoc with the formatting. I use "jvscrpt".

--
Johannes
From: Mike Duffy on
Garrett Smith <dhtmlkitchen(a)gmail.com> wrote in
news:hths72$kmp$1(a)news.eternal-september.org:

>
> I'm the exact opposite. I love it when the SLOC decreases.

This is my sentiment as well. Sometimes, when the code I "really
wanted" falls out at the end of the exercise, I feel like I did during
school at the end of a mathematical proof, when voluminous reams of
inferences and predicates have been distilled into a few lines of
empirical wisdom.
From: Stefan Weiss on
On 26/05/10 10:30, Sean Kinsey wrote:
> On May 26, 2:30 am, Stefan Weiss <krewech...(a)gmail.com> wrote:
>> Does anybody here know of a tool which can count the number of source
>> files and lines of code used in a project, and will parse JS files as
>> well as the more commonly supported languages (C, C++, Java, Python,
>> Perl, etc)? I've been using SLOCCount [0] since 2005, and it's a nice
>> toy, but it hasn't been maintained since its release, and it still
>> ignores JS files, SQL stored procedures, and many others. In some
>> projects, these file types make up more than half of the code, so I'm
>> looking for alternatives.
....
> Take a look at Ohcount (http://www.ohloh.net/p/ohcount), the tool used
> by Ohloh.net
> It works quite well

Thanks, this looks very interesting. I haven't managed to compile it
without errors yet, but there are Debian and Ubuntu packages (for more
recent distro versions than mine). I'll give it a try after my next
system upgrade.


--
stefan
From: Stefan Weiss on
On 26/05/10 04:26, Johannes Baagoe wrote:
> Stefan Weiss :
>> I've been using SLOCCount [0] since 2005, and it's a nice toy,
>
> I didn't know its existence, thanks for pointing it out! Great fun.
>
>> but it hasn't been maintained since its release, and it still ignores
>> JS files, SQL stored procedures, and many others.
>
> An `--addlang sql` option will add sql. `--addlangall` adds sql,
> makefiles and html.

Right, I forgot about those :)
Thanks.

> It should be easy to add support for .js files:
> http://www.dwheeler.com/sloccount/sloccount.html#adding

I have to admit I didn't try to extend SLOCCount directly. Lazy as I am,
I just searched the web for a JavaScript module for SLOCCount, came up
empty, and gave up. I'll look into it. Thanks.

>> PS: Again, just in case: I only use SLOCCount for fun. I'm not taking
>> the numbers seriously. I suppose I could try to impress clients with
>> the $$ figures, but I'd consider that lying.
>
> Quite. But it is fun to see how rich one would supposedly be, if
> only one had the right mentality. My latest project is valued at
> $ 4,721,012. (In order to figure out why a function suddenly became 25 %
> slower after a functionally insignificant change, I used the gcc -S
> option to produce intermediary asm files. They turn out to represent
> 133261 SLOC, 97.52% of the total.)

Heh. I guess that's also the reason why SQL is disabled by default. Now
what will my project be worth if I include the database dump... wow, I'm
rich!


--
stefan
From: Stefan Weiss on
On 26/05/10 13:05, Thomas 'PointedEars' Lahn wrote:
> Stefan Weiss wrote:
>
>> I suppose it's possible, in theory, to write a parser using sed, as
>> Thomas suggested, but it would be either very complex, or unsafe.
>
> WFM. In practice, automatically, as a post-commit hook. wc -l says 20 LOCs
> (counting the empty ones ;-)).

I assume that's a hook for Subversion? I only ever used the hooks to set
permissions and send out email notices. What's the use case for removing
comments post commit?

I gave up on my last attempt at writing a regex-based comment remover
for JavaScript (in Perl, not sed) after I realized I'd probably need a
proper parser. Would you mind posting your solution?


--
stefan