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

Brett Cannon brett at python.org
Mon Nov 17 18:23:29 CET 2014


On Mon Nov 17 2014 at 12:06:15 PM Stefan Bucur <stefan.bucur at gmail.com>
wrote:

> Mark, thank you for the pointer! I will re-send my message there. Should I
> include both mailing lists in a single thread if I end up receiving replies
> from both?


No as cross-posting becomes just a nightmare of moderation when someone is
not on both lists; please only post to a single mailing list.

-Brett


>
> Cheers,
> Stefan
>
>
> On Mon Nov 17 2014 at 4:04:45 PM Mark Shannon <mark at hotpy.org> wrote:
>
>> Hi,
>>
>> I think this might be a bit off-topic for this mailing list,
>> code-quality at python.org is the place for discussing static analysis
>> tools.
>>
>> Although if anyone does have any comments on any particular checks
>> they would like, I would be interested as well.
>>
>> Cheers,
>> Mark.
>>
>>
>> On 17/11/14 14:49, 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.
>> >
>> > My preliminary list of Python checks is quite rudimentary, but maybe
>> > could serve as a discussion starter:
>> >
>> > * Proper Unicode handling (for 2.x)
>> >    - encode() is not called on str object
>> >    - decode() is not called on unicode object
>> > * Check for integer division by zero
>> > * Check for None object dereferences
>> >
>> > Thanks a lot,
>> > Stefan Bucur
>> >
>> > [1] http://clang-analyzer.llvm.org/available_checks.html
>> >
>> >
>> >
>> > _______________________________________________
>> > Python-Dev mailing list
>> > Python-Dev at python.org
>> > https://mail.python.org/mailman/listinfo/python-dev
>> > Unsubscribe: https://mail.python.org/mailman/options/python-dev/
>> mark%40hotpy.org
>> >
>>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> brett%40python.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20141117/e15a51a9/attachment.html>


More information about the Python-Dev mailing list