[bind10-dev] pychecker, pyflakes, pylint

Shane Kerr shane at isc.org
Fri Mar 12 09:14:20 UTC 2010


Jeremy,

On Thu, 2010-03-11 at 16:56 -0600, Jeremy C. Reed wrote:
> I am curious: where did you get these installed from?

I run Ubuntu, so my first attempt is always to try the package manager,
and it usually works:

$ sudo aptitude install pychecker
$ sudo aptitude install pyflakes
$ sudo aptitude install pylint

I confess that having a rocking packaging system has made me quite
lazy. :)

The versions installed are:

shane at shane-asus-laptop:~$ dpkg-query -l pychecker pyflakes pylint
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  pychecker      0.8.18-2ubuntu Finds common bugs in Python source code
ii  pyflakes       0.3.0-1        passive checker of Python programs
ii  pylint         0.18.0-1ubuntu python code static checker and UML diagram g

> pyflakes not ported to python 3.1 yet.
> but now I found a port of it to python3
> http://eric-ide.python-projects.org/eric-news.html
> (I have pyflakes installed so I should try running it with python25 to 
> analyze python 3.1 code.)
> 
> pylint not ported to python 3.1 yet.
> http://www.logilab.org/ticket/19645
> 
> Also I thought pychecker wasn't ported (won't install for me with 
> python3.1 so I need to look further). (Maybe I could try running it with 
> older python.)
> 
> I had emailed developers for pyflakes and pychecker last month but never 
> heard back.
> 
> If you have any hints for getting these to install and work correctly 
> for python31 I'd appreciate it.

Well, they are clearly not perfect. I ran pyflakes and pylint on
b10-loadzone, and they both choked on print syntax:

    print("Usage: %s [-d <database>] [-o <origin>] <file>" % sys.argv[0], \
          file=sys.stderr)

They don't like setting the output via the "file=" portion; I guess this
is Python 3.x syntax. It probably means that the language is 95%
compatible, so it worked for the boss, but won't work in general.

As for the specific results... pyflakes only discovered that the regular
expression module, re, was not being used. pychecker complained about a
number of cases where builtins were being blocked (using variable names
such as "file" or "list").

I guess these are not ready to be used in an automated way. :(

To be honest, unlike the C++ checking, none of the Python problems found
was particularly insightful or likely to cause problems, so this isn't a
huge loss.

--
Shane




More information about the bind10-dev mailing list