python metrics program/script sample

F. Petitjean littlejohn.75 at noos.fr
Mon Dec 27 19:06:21 CET 2004


On Mon, 27 Dec 2004 12:09:16 -0500, Peter Hansen <peter at engcorp.com> wrote:
> Philippe C. Martin wrote:
>> I am looking for an eric3/linux compatible alternative to checking code 
>> metrics (ex: true lines of code count)
> 
> I don't know what "eric3/linux compatible" might be, I'm not sure
> what this would be an alternative _to_, and I don't know what you
> mean by "true" lines of code count, but the only thing I've
> noticed lately that counts lines of Python code, and I'm fairly
> sure it would run fine on Linux, is pycount.  Google for it...
> 
> -Peter
You can also use pylint (logilab.org) which print something like :
Report
======
57 statements analysed.

[snip]

Raw metrics
-----------

type      number %     previous difference
:::::::::::::::::::::::::::::::::::::::::::
code      61     64.21 61       =
docstring 22     23.16 22       =
comment   3      3.16  3        =
empty     9      9.47  9        =


As it is pure python it should not be difficult to adapt to your needs.
(but do not feed pylint with a module with tabs, the final 'Global
evaluation' will be deceitfull)

Sorry for bad english, I'm not a native speaker.



More information about the Python-list mailing list