[code-quality] Static checker for common Python programming errors
Stefan Bucur
stefan.bucur at gmail.com
Tue Nov 25 11:50:16 CET 2014
On Tue Nov 18 2014 at 1:25:07 PM Claudiu Popa <pcmanticore at gmail.com> wrote:
> 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
>
This is very interesting (and a good reminder of the existence of the
for/else construct, which I should probably use more often :) ).
It would actually be nice to have a suite of such snippets, to be able to
benchmark analysis tools more uniformly.
Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/code-quality/attachments/20141125/718b78d1/attachment.html>
More information about the code-quality
mailing list