Fundamentals 3 min read
Boost Python Code Quality: Quick Guide to Installing and Using Flake8 with Git
This guide walks you through installing Flake8 on CentOS 6.4 with Python 2.6, adding optional plugins, running the linter on your files, and integrating it into Git hooks to automatically enforce coding standards.
MaGe Linux Operations
MaGe Linux Operations
Reference documentation:
http://blog.csdn.net/gaoyingju/article/details/50449522 http://flake8.readthedocs.org/en/latest/
Environment assumptions:
OS: CentOS release 6.4 (Final) Python: Python 2.6.6 Flake8: 2.5.1 (pep8: 1.5.7, flake8_quotes: 0.1.1, pyflakes: 1.0.0, flake8-debugger: 1.4.0, flake8-respect-noqa: 0.2, flake8-todo: 0.4, import-order: 0.6.1, flake8-immediate: 0.2, radon: , mccabe: 0.3.1, flake8-print: 2.0.1, naming: 0.3.3) CPython 2.6.6 on Linux
Installation steps:
pip install flake8 Optional plugins (install as needed): pip install pep8-naming pip install flake8-import-order pip install flake8-todo pip install flake8-quotes pip install flake8-immediate pip install flake8-debugger pip install radon pip install flake8-print pip install flake8-respect-noqa
How to use:
flake8 filename.py More options are available for you to explore.
Git integration:
flake8 --install-hook git config flake8.strict true
Test results:
Original Source
Signed-in readers can open the original source through BestHub's protected redirect.
Republication Notice
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Reader feedback
How this landed with the community
Rate this article
Was this worth your time?
Discussion
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
