Over the years, bad programmers have been in and commented large sections of code, often the whole content of a function and left it there. I want to go across the code base looking for examples like this, so that I can direct developers to go back and clean some of this mess up. I have >10,000 files so I'd like a bash script to do this for me.
What I'd ultimately like is something that goes through text files in a linux fs and outputs, per file, the character counts of code vs. comment.
What I've tried:
sed - a few questions on here lead to regular expressions that find // lines and /* */ pairs and remove the comments associated. I've tried a few snippets but they seems to fail (not return) on enough of my code, or strip out non-comments - so I think regex is not the way to go.
yui-compressor - I tried this but I couldn't find how to make it just strip comments. Minifying meant my
wc -c results were too skewed
Given that you are unclear about the OS, it'll be hard to guess what command line parser you have. (wc is available under Linux and with cygwin, under windows).
That would probably work for you, based on Seibel's assertion that escript is ECMAScript 4 compliant.