Error / Violation Codes
Flake8 and its plugins assign a code to each message that we refer to as an 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 |
F501 |
invalid |
F502 |
|
F503 |
|
F504 |
|
F505 |
|
F506 |
|
F507 |
|
F508 |
|
F509 |
|
F521 |
|
F522 |
|
F523 |
|
F524 |
|
F525 |
|
F541 |
f-string without any placeholders |
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 is always |
F632 |
use |
F633 |
use of |
F634 |
if test is a tuple, which is always |
F701 |
a |
F702 |
a |
F704 |
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 |
F821 |
undefined name |
F822 |
undefined name |
F823 |
local variable |
F831 |
duplicate argument |
F841 |
local variable |
F901 |
|
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.