[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Static checker for common Python programming errors

On 2014-11-18 01:21, Terry Reedy wrote:
> On 11/17/2014 9:49 AM, Stefan Bucur 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 syntactic
>> level) by going deeper with the code analysis and keeping track of the
>> possible control flow paths in the program (path-sensitive analysis).
>> For instance, a path-sensitive analysis detects that the following
>> snippet of code would raise an AttributeError exception:
>> if object is None: # If the True branch is taken, we know the object is None
>>    object.doSomething() # ... so this statement would always fail
>> I'm writing first to the Python developers themselves to ask, in their
>> experience, what common pitfalls in the language & its standard library
>> such a static checker should look for. For instance, here [1] is a list
>> of static checks for the C++ language, as part of the Clang static
>> analyzer project.
> You could also a) ask on python-list (new thread), or scan python
> questions on StackOverflow.  Todays's example: "Why does my function
> return None?"  Because there is no return statement.  Perhaps current
> checkers can note that, but what about if some branches have a return
> and others do not?  That is a likely bug.
Mutable default parameters comes up occasionally.