A new version of PyChecker is available for your hacking pleasure.
PyChecker is a tool for finding bugs in python source code. It finds problems that are typically caught by a compiler for less dynamic languages, like C and C++. It is similar to lint.
Comments, criticisms, new ideas, and other feedback is welcome.
There are still a few problems with Python 2.2 and nested scopes, but for the most part it should work pretty well.
The unreachable code option is off by default. There are still some problems with spurious warnings. But help with simple test cases would be appreciated.
Changes from 0.8.6 to 0.8.7: * Add -2/--constcond option to warn if using a constant in a conditional statement (if '': ; while 'str': ; etc) Also this: assert(x == 53, "hey, x != 53") * Add -1/--constant1 option to warn when using if 1: or while 1: etc. * Add -8/--unreachable option to warn about unreachable code * Add -9/--members option to warn about unused data members * Add -w/--shadow for local variable shadowing global variable * Add warning statements with no effect, for example: fp = open('file') fp.close # oops, forgot to call the method fp.close() * Handle string multiplication (helps format strings) code like this doesn't generate a warning now: '%d ' * 3 % (1, 2, 3) * Fix -C/--implicitreturns option so it works, turn it on by default * Fix spurious warning when accessing 'static' class members that are methods (e.g. class C(B): __super_init = B.__init__) (still a problem w/2.2) * Fix some strange spurious warnings and exceptions * Handle nested scopes better, includes fixing a crash and eliminating some spurious warnings
I don't think I announced v 0.8.6, so here are the changes from 0.8.5 to 0.8.6: * Add -5/--maxrefs for maximum # of identifier references (Law of Demeter) * Fix problem where user defined classes weren't checked for valid attributes * Allow use of __pychecker__ in class scope * Fix a lot of global function arg counts for Python 2.2 (many constructors can take no arguments now) * Fix spurious warning (Function return types are inconsistent) when multiple returns w/a constant & a local variable of same type * Fix spurious warning for format strings when using a dict local variable * Rename pychecker.sh script to pychecker on Unix
Neal -- email@example.com