pychecker vs pylint vs Django

Posted in: Django, Python

I just used pychecker on Django and it helpfully found a few bugs. However, it printed a lot of warnings that were wrong, and it obviously has some bugs itself:

        Traceback (most recent call last):
          File "/usr/lib/site-python/pychecker/",
          line 222, in _checkFunction
          File "/usr/lib/site-python/pychecker/",
          line 180, in _findUnreachableCode
            lastLine, lastItem, lastIndex =
        IndexError: list index out of range

So just how good is pychecker?

$ pychecker pychecker
Processing pychecker...



Pretty good — according to itself! Lets try another experiment:

$ pylint pychecker
************* Module pychecker

[snip 1600 lines]

Global evaluation
Your code has been rated at 5.65/10

5.65 out of 10 — ha! I detect some bias in pychecker’s assessment of itself! Why are we even listening to pychecker! pylint is obviously miles better — look:

$ pylint pylint
[snip 100 lines]

Global evaluation
Your code has been rated at 9.89/10

Pretty hot! Let’s try pylint on Django:

$ pylint django
************* Module django

[snip 7000 lines]

Global evaluation
Your code has been rated at 5.19/10

Bummer. That didn’t go where I wanted it to. Actually, why I am listening to what some dumb program says about Django? Who appointed pylint as the arbiter of code style: … Line too long (208/80)Too many local variables (23/15) …? Bah!

On a more serious note, I think pylint (especially pylint | egrep '^E:') has some useful output, though it still makes mistakes. At some point I intend to go through it more carefully. The problem is there is so much of it — perhaps it would be nice to have a ‘pylintdiff’ type command — what errors is pylint giving that it didn’t last time. I guess that would be a few lines of shell script.

Comments §

blog comments powered by Disqus