Re: LOC counters

From: Date: Wed, 04 Sep 2002 15:38:04 +0000
Subject: Re: LOC counters
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-115188@lists.php.net to get a copy of this message
Todd Pasley wrote: > > Hi, > > Firstly, please resist the opportunity to flame.... > > I'm looking for a PHP (among other things) Line Of Code counter. Has anyone > used any descent ones? I was thinking of writing one myself, but, if there > are others available, I might as well save the time. > > There is much debate over the appropriateness of LOC as a measurement, I > have chewed up a lot of time with discussion over this so I'm not going to > bite this time :) I like this quick and dirty solution which doesn't count lines with just braces or just whitespace. nor does it count C++ style comment lines. I have it in my .bashrc file: alias countcode='cat *.inc */*.inc */*/*.inc */*/*/*.inc */*/*/*/*.inc */*/*/*/*/*.inc */*/*/*/*/*/*.inc */*/*/*/*/*/*/*.inc | grep -v '\''^[[:space:]]*$'\'' | grep -v '\''^[[:space:]]*[{}][[:space:]]*$'\'' | grep -v '\''^[[:space:]]*//'\'' | grep -v '\''^<?//'\'' | grep -c '\''.*'\''' Then from my linux command line I just type countcode. And yes I know I could have come up with something better than */*/*/..., but like I said "QUICK AND DIRTY" :) Cheers, Rob. -- .-----------------. | Robert Cummings | :-----------------`----------------------------. | Webdeployer - Chief PHP and Java Programmer | :----------------------------------------------: | Mail : mailto:robert.cummings@webmotion.com | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------'

« previous php.general (#115188) next »