views:

128

answers:

2

For HTML, CSS, and JavaScript files, what's a good tool to run on source directories and get KSLOC?

+2  A: 

wc -l is a good start.

Hank Gay
not sure why this was downvoted. It does the trick and gives a meaningful number that's pretty much just as useful as any other SLOC metric.
Mr. Shiny and New
fair enough. i was interested in an automated, configurable tool with reporting and code visualization options. but unless mgmt presses for more, a raw count will suffice.
happyappa
+2  A: 
grep -v -P "^\s*$" -R dir/ | wc -l

Gives you a line count that ignores blank lines.

Mr. Shiny and New
thx. i'm on a solaris box, and a couple of those grep args aren't supported in this environment. ended up w/ something like: find dir/ | xargs grep -v "^$" | wc -l
happyappa