Quick way to calculate lines of code/comments in a collection of Python scripts?

Stephen Tucker stephen_tucker at sil.org
Mon Oct 24 05:03:29 EDT 2016


Tomasz,

How about using the command prompt command FIND /C  on each of your source
files as follows:

FIND/C "#" <SourceFile.py >>NumbersOfLinesContainingPythonComments.dat
FIND/C /V "#" <SourceFile.py >>NumbersOfLinesNotContainingPythonComments.dat

You would end up with two files each with a column of line counts;

Import these lines into an Excel Spreadsheet and calculate whatever you
like with them.

Stephen.



On Sun, Oct 23, 2016 at 9:51 PM, Tomasz Rola <rtomek at ceti.pl> wrote:

> On Wed, Oct 05, 2016 at 01:56:59PM -0400, Malcolm Greene wrote:
> > Looking for a quick way to calculate lines of code/comments in a
> > collection of Python scripts. This isn't a LOC per day per developer
> > type analysis - I'm looking for a metric to quickly judge the complexity
> > of a set of scripts I'm inheriting.
> >
> > Thank you,
> > Malcolm
>
> A bit more than what you asked for (and sorry for being late) but I
> find sloccount quite good. Or at least interesting (computes sloc and
> some stats about project, given project dir or a single file with
> code):
>
> http://www.dwheeler.com/sloccount/
>
> --
> Regards,
> Tomasz Rola
>
> --
> ** A C programmer asked whether computer had Buddha's nature.      **
> ** As the answer, master did "rm -rif" on the programmer's home    **
> ** directory. And then the C programmer became enlightened...      **
> **                                                                 **
> ** Tomasz Rola          mailto:tomasz_rola at bigfoot.com             **
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list