Python Grammer and Coding Style Checking Tools

In this post, several python/C coding style documentaion and static chekcing tools are introduced.

Style recommendations

The main proposals in python ecosystem is indexed by PEPs (Python Enhancement Proposals) whose index number is allocated by the PEP editors. In PEPs, the 7th and 8th proposals defines the C and Python coding styles recommended.

Another important feature in Python is a clear and readable in-code documentation, also called “docstring” in python. PEP257 shows a simple recommendation about that.

Static checking tools

Brilliant pythoners have contributed several wonderful grammer/style analyzing tools in accordance with PPE8 recommendation, such as flake8, pep8, PyChecker, PyFlakes, PyLint etc. For my faviorate, flake8 meets most of my requirements in daily programming. But you can choose a suitable one for yourself. For others’ opinions, you can follow the thread on SO.

Editor plugins

For Sublime Text, flake8 has its plugin Flake8Lint. You can also ask google about your package option. In Eclipse, pep8 is integrated in PyDev (2.3.0+) by default. You can enable it manully if its not activated in your settings:

Open Window > Preferences > PyDev > Editor > Code Analysis > pep8.py

© 2017 InnoTrek All Rights Reserved.
Theme by hiero