[Python-Dev] Static checker for common Python programming errors (original) (raw)
Guido van Rossum guido at python.org
Mon Nov 17 18:25:50 CET 2014
- Previous message: [Python-Dev] Static checker for common Python programming errors
- Next message: [Python-Dev] Static checker for common Python programming errors
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Also, I should mention mypy (mypy-lang.org), which is a much more ambitious project that uses type annotations. I am trying to find time to work on a PEP that standardizes type annotations to match mypy's syntax (with probably some improvements and caveats). It's too early to post the PEP draft but if you're designing a type checker or IDE that could use help from type annotations, email me.
On Mon, Nov 17, 2014 at 6:49 AM, 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 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/availablechecks.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/guido%40python.org
-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20141117/2ab92743/attachment.html>
- Previous message: [Python-Dev] Static checker for common Python programming errors
- Next message: [Python-Dev] Static checker for common Python programming errors
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]