Skip to content
florentx edited this page Dec 20, 2012 · 3 revisions

Quick-and-dirty list of error codes.

From the module docstring:

Groups of errors and warnings:
E errors
W warnings
100 indentation
200 whitespace
300 blank lines
400 imports
500 line length
600 deprecation
700 statements
900 syntax error

More detailed list (as of pep8 version 1.3.4+)

E101: indentation contains mixed spaces and tabs

E111: indentation is not a multiple of four
E112: expected an indented block
E113: unexpected indentation

E121: continuation line indentation is not a multiple of four
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 does not distinguish itself from 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

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 optional whitespace around operator

E231: missing whitespace after ','

E241*: multiple spaces after ','
E242: tab after ','

E251: no spaces around keyword / parameter equals

E261: at least two spaces before inline comment
E262: inline comment should start with '# '

E271: multiple spaces after keyword
E272: multiple spaces before keyword
E273: tab after keyword
E274: tab before 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

E401: multiple imports on one line

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)

E711: comparison to None should be 'if cond is None:'
E712: comparison to True should be 'if cond is True:' or 'if cond:'

E721: do not compare types, use 'isinstance()'

E901: SyntaxError or IndentationError
E902: IOError

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

W601: .has_key() is deprecated, use 'in'
W602: deprecated form of raising exception
W603: '<>' is deprecated, use '!='
W604: backticks are deprecated, use 'repr()'

(*) In the default configuration, the checks E226 and E241 are ignored because they are not rules unanimously accepted, and PEP 8 don't enforce them.

Note: most errors can be listed with such one-liner:

python pep8.py --first --select E,W testsuite/ --format '%(code)s: %(text)s'
Clone this wiki locally