Error / Violation Codes¶
Flake8 and its plugins assign a code to each message that we refer to as a error code (or violation). Most plugins will list their error codes in their documentation or README.
Flake8 installs pycodestyle, pyflakes, and mccabe by default and
generates its own error codes for pyflakes:
Code |
Example Message |
|---|---|
F401 |
|
F402 |
import |
F403 |
‘from |
F404 |
future import(s) |
F405 |
|
F406 |
‘from |
F407 |
an undefined |
F601 |
dictionary key |
F602 |
dictionary key variable |
F621 |
too many expressions in an assignment with star-unpacking |
F622 |
two or more starred expressions in an assignment |
F631 |
assertion test is a tuple, which are always |
F632 |
use |
F633 |
assertion test is a tuple, which are always |
F701 |
a |
F702 |
a |
F703 |
a |
F704 |
a |
F705 |
a |
F706 |
a |
F707 |
an |
F721 |
syntax error in doctest |
F722 |
syntax error in forward annotation |
F723 |
syntax error in type comment |
F811 |
redefinition of unused |
F812 |
list comprehension redefines |
F821 |
undefined name |
F822 |
undefined name |
F823 |
local variable |
F831 |
duplicate argument |
F841 |
local variable |
F901 |
|
Note that some of these entries behave differently on Python 2 and Python 3, for example F812 is specific to Python 2 only.
We also report one extra error: E999. We report E999 when we fail to
compile a file into an Abstract Syntax Tree for the plugins that require it.
mccabe only ever reports one violation - C901 based on the
complexity value provided by the user.
Users should also reference pycodestyle’s list of error codes.