sloccount and sloc2html.py: Because size does matter

I’m not a coder, and I try whenever possible to repeat that, at the top of my lungs.

There are some coder’s tools that I think are nifty though. Way back in the C section we had codemetre, for checking the length and breadth of your efforts, and comparing that with the number of commented lines.

In a similar vein, here’s sloccount, which goes a step further by counting out lines of types of code, summing them across an entire project, and showing some basic analysis.

2014-04-28-6m47421-sloccount

And that’s what you get if you point it at the source for the 3.14.2 kernel. πŸ˜‰

sloccount is nifty by itself, no doubt about it. If you’re willing to make a small leap toward the graphical, sloc2html.py will — as you might expect — convert the results of sloccount into something browser-oriented.

2014-04-28-6m47421-sloc2html

This is where things start to break down, because the home page for sloccount also hosts a touched-up version of sloc2html.py, but the link to the actual python program is dead. I scraped around the internets and I think I found a reasonable facsimile thereof, here. I have no way of knowing if that’s the right one though. πŸ˜•

The problem is that, as with so many python programs I encounter, it seems that advances in python proper spawn errors in sloc2html.py, the least of which seemed to occur with Arch’s python2 in charge. What you see above is what sloc2html.py could write out, before it crashed and burned.

I think you get an idea of what it should be doing though, from the screenshot. If you are a pythonian, you might be able to get it going with version 3+, with a little effort. I lack the requisite skills for that.

Which is what I mentioned at the start of this post. Clever, aren’t I? πŸ˜‰

Advertisements

One thought on “sloccount and sloc2html.py: Because size does matter

  1. Pingback: cloc: Clock your code | Inconsolation

Comments are closed.