Meanwhile Install it using
$ sudo pip install flake8
Fedora users
$ sudo dnf install python-flake8
Ubuntu users
$ sudo apt-get install python-flake8
-Guido Van Rossum
Flake8 is a wrapper around these tools:
It checks Python source files for errors. It analyzes programs and detects various errors. It works by parsing the source file, not importing it, so it is safe to use on modules with side effects. It’s also much faster.
Python Enhancement Proposal (PEP), PEP8 is document that gives coding conventions for the Python code comprising the standard library in the main Python distribution.
PEP8 is not mandatory but important to bring consistency in code everywhere, so the code matches stylistically.
Consistency in code helps it make more readable.
What matters always is P vs NP
It is used to check Cyclomatic complexity of the code, useful to detect over-complex code.
Install hook by issuing following command in your project's root directory
$ flake8 --install-hook
Each code consists of an upper case ASCII letter followed by three digits. The recommendation is to use a different prefix for each plugin. A list of the known prefixes is published below:
E***/W***
: pep8 errors and warningsF***
: PyFlakes codes (see below)C9**
: McCabe complexity plugin mccabeN8**
: Naming Conventions plugin pep8-namingLets see it working
$ flake8 notebook-master
$ flake8 --benchmark notebook-master
$ flake8 --show-pep8 spendings
$ flake8 --show-source spendings
Measuring complexity
$ flake8 --max-complexity 2 notebook-master