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:
.../django/db/models/options.py:134: INTERNAL ERROR -- STOPPED PROCESSING FUNCTION --
Traceback (most recent call last):
File "/usr/lib/site-python/pychecker/warn.py", line 222, in _checkFunction
_findUnreachableCode(code)
File "/usr/lib/site-python/pychecker/warn.py", line 180, in _findUnreachableCode
lastLine, lastItem, lastIndex = code.returnValues[-1]
IndexError: list index out of range
So just how good is pychecker?
$ pychecker pychecker
Processing pychecker...
Warnings...
None
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 §
Use pylint -e instead of grepping for ^E it will run much faster.
Also don't hesitate to report what you feel are false positives to the authors of pylint: thats one of the nicest ways to enhance the tool (patches are welcome too)
Unfortunately, the project seems to address issues like this very slowly. For example, pylint incorrectly flags "import string" as importing a deprecated module; this was reported three and a half years ago, and it still flags it today. :-/
http://www.logilab.org/email/2258
Yes I know this post is old.