Gere
Gere

Reputation: 12717

Write custom code analysis tool for Python/Pydev?

What is the easiest way to write a code analysis tool where I can issue warnings on some custom possible design flaws in the program? Most warnings I'm thinking of are OOP related.

Ideally I would write a plugin for some already existing parser and integrate it in Eclipse/Pydev. Can I extend pylint conveniently? Or is there some aid from Pydev?

What is the most effortless way?

Upvotes: 3

Views: 557

Answers (1)

Fabio Zadrozny
Fabio Zadrozny

Reputation: 25372

You can extend PyDev itself: grab its code and do some analysis with it. At the code-level: com.python.pydev.analysis.OccurrencesAnalyzer is the starting place (to get the code: http://www.pydev.org/developers.html).

It already has ways of parsing the code to get the AST with a visitor structure you can use for the analysis.

For simpler checks you could just improve upon the pep8.py that's distributed in PyDev itself (/org.python.pydev/pysrc/third_party/pep8/pep8.py).

Upvotes: 3

Related Questions