5

Which helpful static code analysis can you recommend for Python. I believe they are useful for refactoring code. I know

  • snakefood for module dependencies
  • pycallgraph for dynamic call graphs
  • pylint for bugs

Are there static call analyzers? If I wanted to program a custom one, which would be the easiest way?

What other type of static code checks can you think of? Or maybe even some Python magic like ABCs?

EDIT: I've found that either using http://docs.python.org/3.3/library/ast.html or maybe even http://www.astroid.org/ can be used to program some custom parser. Then one can use graphviz to visualize or even PlantUML for UML graphs.

Gerenuk
  • 11,281
  • 17
  • 53
  • 87

4 Answers4

2

check out pychecker and pyflakes. There was a famous question to discuss the pylint-pychecker-or-pyflakes

Community
  • 1
  • 1
zhutoulala
  • 4,732
  • 2
  • 20
  • 32
2

this is a very powerful python type inferencer https://github.com/yinwang0/pysonar2

it has strong bug check ability but it's not exposed through its interface, but I assume you could do many awesome checks based on it.

BigGameHunter
  • 93
  • 1
  • 4
tazdingo
  • 61
  • 5
0

Not exactly "static code analyzer" but even a bit more:

http://code.google.com/p/shedskin/

Ecir Hana
  • 9,720
  • 13
  • 61
  • 110
0

Pysonar2 is a very nice implementation of abstract interpretation to type inference Python projects. My answer to another similar question is here.

Community
  • 1
  • 1
Wei Chen
  • 175
  • 1
  • 8