The following table shows the occurence counts of style issues submitted to the Python 3 style checker.
The text {character}
will mean the style issue involves one of the following characters: ()[]{}'":; ,.
Line is longer than 79 characters.
Blank lines should not contain any tabs or spaces.
Line has an indentation level that is not a multiple of four.
Line is missing whitespace around one of the following characters: ,
;
and :
.
Line is missing whitespace around an operator.
Line contains whitespace after the final character.
Line contains spaces before or after the =
in a function definition.
This function should have a docstring.
Two blank lines are expected before and after each function or class.
Module (the term for the Python file) should have a docstring.
The first line in docstrings should end with a period.
The first line in docstrings should read like a command.
Line is indented less than it should be.
Files should end with a newline.
Comments should start with a #
character and have one space between the #
character and the comment itself.
Line contains an inline comment that does not have 2 spaces before it.
Methods should have docstrings.
Too many blank lines.
There should be 1 blank line between the summary line and the description.
Line contains tabs when only spaces are expected.
Line contains a {character} that has a space before it.
Functions and classes should have two blank lines after them.
Variables in functions should be lowercase.
Line contains a {character} that has a space before it.
Comments have a space between the #
character and the comment message.
Line has an indentation level that is not a multiple of four.
Line has too many indentation levels.
Function docstrings should not have blank lines after them.
Docstrings that are one line long should fit on one line with quotes.
Class should have a docstring.
The __init__
method should have a docstring.
Line is indented more than it should be.
Comparisons to objects such as True
, False
, and None
should use is
or is not
instead of ==
and !=
.
Line is not indented as far as it should be or is indented too far.
Program failed to compile.
There are either zero, two, or more than two blank lines at the end of your file.
Backslash is used to escape a character that cannot be escaped.
The first word in the first line should be capitalised.
Function names should be lowercase.
Line is indented using a mixture of spaces and tabs.
Docstrings that are longer than one line should have closing quotes on a separate line.
Text in docstrings should not be surrounded by whitespace.
Mixed case variable used in the global scope
Use """triple double quotes""" around docstrings.
Except block is calling all exceptions, instead it should catch a specific exception.
There is no need for a backslash (\
) between brackets.
Argument names should be lowercase.
Class docstrings should have 1 blank line after them.
Line contains a {character} that has a space before it.
Magic methods should have docstrings.
Line contains a {character} that has a space after it.
Docstring is over-indented.
Module imports should be at the top of the file and there should be no statements in between module level imports.
Line is not indented at the correct level.
Function docstrings should not have blank lines before them.
Line is missing a blank line between the methods of a class.
Line is indented when it shouldn't be.
Line has multiple spaces after an operator.
Line contains multiple statements.
Line has multiple spaces before an operator.
Line has a closing bracket that does not match the indentation of the opening bracket.
Comments should only start with a single #
character.
Comparisons to objects such as True
, False
, and None
should use is
or is not
instead of ==
and !=
.
Line contains more than one space after a keyword.
Line has the same indentation as the next logical line.
Nested definitions should have one blank line before them.
Line is not aligned correctly for a hanging indent.
Line has a continuation that should be indented one extra level so that it can be distinguished from the next logical line.
Line uses one of the variables named l
, O
, or I
Docstring is under-indented.
Class names should use the CapWords convention.
Line is missing whitespace around a modulo operator (%
).
Change outer quotes to avoid escaping inner quotes.
Line ends in a semicolon (;
).
Line contains multiple statements.
Line contains imports from different modules on the same line.
Class docstrings should not have blank lines before them.
When testing whether or not something is in an object use the form x not in the_object
instead of not x in the_object
.
Public nested classes should have docstrings.
The first argument of a method should be named self
.
Line contains a blank line after a function decorator.
Import that should have been imported as lowercase has been imported as non lowercase
Line contains more than one space before a keyword.
Line assigns a lambda expression instead of defining it as a function using def
.
The first line in docstrings should not be a copy of the function’s definition.
<>
has been removed in Python 3.
Import that should have been imported as camelCase has been imported as lowercase.
Line is missing whitespace around a bitwise or shift operator (<<
, >>
, &
, |
, ^
).
Mixed case variable used in the class scope
Use r""" if there are any backslashes in a docstring.
Line is indented when it shouldn't be.
Docstrings should be indented using spaces, not tabs.
Line is not indented at the correct level.
Sections in docstrings must have content.
Import that should have been imported as camelCase has been imported as an acronym.
There should be no blank lines between a section header and its content.
Line contains a tab character after an operator.
Function names should not start and end with __
(double underscore).
Line contains a tab character before an operator.
When testing for object identity use the form x is not None
rather than not x is None
.
Line contains a tab character before a keyword.
You should compare an objects type by using isinstance()
instead of ==
. This is because isinstance
can handle subclasses as well.
Import that should have been imported as a constant has been imported as a non constant.
Import that should have been imported as camelCase has been imported as a constant.
The first argument of a classmethod should be named cls
.
Line contains a tab character after a keyword.
Line is missing a space after a keyword.
Line contains a function named l
, O
, or I
.has_key()
was deprecated in Python 2. It is recommended to use the in
operator instead.
Using raise ExceptionType, message
is not supported.
Backticks have been removed in Python 3.
async
and await
are reserved names
Packages should have docstrings.
Class docstrings should have 1 blank line before them.
Docstrings that are more than one line long should start at the first line.
Docstrings that are more than one line long should start at the second line.
Section is indented by too many levels.
Section underline is indented by too many levels.
Use u""" for docstrings that contain Unicode.
First word of the docstring should not be 'This'.
Section name should be properly capitalised.
Section names should end with a newline.
Section names should have a dashed line underneath them.
Dashed line should be on the line following the section's name.
Dashed section underline should match the length of the section's name.
Section should have a blank line after it.
Section should have a blank line before it.
The last section in a docstring should have a blank line after it.
The first line in your docstring should end with a period, question mark, or exclamation point.
Section names should end with a colon.
Docstrings should include argument descriptions.
Line is less indented than it should be.
Line has a closing bracket that does not match the indentation level of the line that the opening bracket started on.
Line is indented more than it should be.
Line is missing whitespace around an arithmetic operator (+
, -
, /
and *
).
Line has multiple spaces after the ,
character.
Line contains a tab character after the ,
character.
Line contains multiple statements.
Line contains a class named l
, O
, or I
Use single quotes (') instead of double quotes (").
Use single quotes (') instead of double quotes (") in multiline strings.
Use single quotes (') instead of double quotes (") in docstrings.
Line break is before a binary operator.
Line break is after a binary operator.
Line is longer than 79 characters.