The Big Ol' List of Rules

Descriptions and examples for each of the rules in Flake8 (pyflakes, pycodestyle, and mccabe).

Created by Grant McConnaughey. For helpful tips on Python and software development, follow me on Twitter or TinyLetter.

pycodestyle

E101 Indentation contains mixed spaces and tabs
E111 Indentation is not a multiple of four
E112 Expected an indented block
E113 Unexpected indentation
E114 Indentation is not a multiple of four (comment)
E115 Expected an indented block (comment)
E116 Unexpected indentation (comment)
E117 Over-indented
E121 Continuation line under-indented for hanging indent
E122 Continuation line missing indentation or outdented
E123 Closing bracket does not match indentation of opening bracket's line
E124 Closing bracket does not match visual indentation
E125 Continuation line with same indent as next logical line
E126 Continuation line over-indented for hanging indent
E127 Continuation line over-indented for visual indent
E128 Continuation line under-indented for visual indent
E129 Visually indented line with same indent as next logical line
E131 Continuation line unaligned for hanging indent
E133 Closing bracket is missing indentation
E201 Whitespace after '('
E202 Whitespace before ')'
E203 Whitespace before ':'
E211 Whitespace before '('
E221 Multiple spaces before operator
E222 Multiple spaces after operator
E223 Tab before operator
E224 Tab after operator
E225 Missing whitespace around operator
E226 Missing whitespace around arithmetic operator
E227 Missing whitespace around bitwise or shift operator
E228 Missing whitespace around modulo operator
E231 Missing whitespace after ',', ';', or ':'
E241 Multiple spaces after ','
E242 Tab after ','
E251 Unexpected spaces around keyword / parameter equals
E261 At least two spaces before inline comment
E262 Inline comment should start with '# '
E265 Block comment should start with '# '
E266 Too many leading '#' for block comment
E271 Multiple spaces after keyword
E272 Multiple spaces before keyword
E273 Tab after keyword
E274 Tab before keyword
E275 Missing whitespace after keyword
E301 Expected 1 blank line, found 0
E302 Expected 2 blank lines, found 0
E303 Too many blank lines (3)
E304 Blank lines found after function decorator
E305 Expected 2 blank lines after end of function or class
E306 Expected 1 blank line before a nested definition
E401 Multiple imports on one line
E402 Module level import not at top of file
E501 Line too long (82 > 79 characters)
E502 The backslash is redundant between brackets
E701 Multiple statements on one line (colon)
E702 Multiple statements on one line (semicolon)
E703 Statement ends with a semicolon
E704 Multiple statements on one line (def)
E711 Comparison to None should be 'cond is None:'
E712 Comparison to true should be 'if cond is true:' or 'if cond:'
E713 Test for membership should be 'not in'
E714 Test for object identity should be 'is not'
E721 Do not compare types, use 'isinstance()'
E722 Do not use bare except, specify exception instead
E731 Do not assign a lambda expression, use a def
E741 Do not use variables named 'I', 'O', or 'l'
E742 Do not define classes named 'I', 'O', or 'l'
E743 Do not define functions named 'I', 'O', or 'l'
E901 SyntaxError or IndentationError
E902 IOError
E999 SyntaxError
W191 Indentation contains tabs
W291 Trailing whitespace
W292 No newline at end of file
W293 Blank line contains whitespace
W391 Blank line at end of file
W503 Line break occurred before a binary operator
W504 Line break occurred after a binary operator
W601 .has_key() is deprecated, use 'in'
W602 Deprecated form of raising exception
W603 '<>' is deprecated, use '!='
W604 Backticks are deprecated, use 'repr()'
W605 Invalid escape sequence 'x'

pyflakes

F401 Module imported but unused
F402 Import module from line n shadowed by loop variable
F403 'from module import *' used; unable to detect undefined names
F404 Future import(s) name after other statements
F405 Name may be undefined, or defined from star imports: module
F811 Redefinition of unused name from line n
F812 List comprehension redefines name from line n
F821 Undefined name name
F822 Undefined name name in __all__
F823 Local variable name ... referenced before assignment
F831 Duplicate argument name in function definition
F841 Local variable name is assigned to but never used
F901 raise NotImplemented should be raise NotImplementedError

mccabe

C901 Function is too complex