[code-quality] Static checker for common Python programming errors

Claudiu Popa pcmanticore at gmail.com
Tue Nov 18 13:25:07 CET 2014


On Mon, Nov 17, 2014 at 7:18 PM, Stefan Bucur <stefan.bucur at gmail.com> wrote:
> I'm developing a Python static analysis tool that flags common programming
> errors in Python programs. The tool is meant to complement other tools like
> Pylint (which perform checks at lexical and AST level) by going deeper with
> the code analysis and keeping track of the possible control flow paths in
> the program (path-sensitive analysis).
>


Hey, Stefan.

That's great! It's really cool to see more people interested in static
analysis with Python.
Control flow analysis is missing in Pylint and due to this, we have a
couple of false positives.
For instance, the following code will emit a raising-bad-type warning,
even though exc is later
reassigned (but not deduced by the inference engine):

   exc = None
   for i in range(10):
       try:
           1 / 0
           break
       except Exception as e:
           exc = e
   else:
      raise exc

I was planning to tackle this issue, by adding a rudimentary flow
statement analysis to Pylint's inference engine, but
oriented on high level paths.


More information about the code-quality mailing list