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: ()[]{}'":; ,.
Blank lines should not contain any tabs or spaces.
Line is longer than 79 characters.
Line has an indentation level that is not a multiple of four.
Line is missing whitespace around an operator.
Line is missing whitespace around one of the following characters: ,
;
and :
.
Line contains spaces before or after the =
in a function definition.
Line contains whitespace after the final character.
This function should have a docstring.
The first line in docstrings should end with a period.
Comments should start with a #
character and have one space between the #
character and the comment itself.
Two blank lines are expected before and after each function or class.
Line is indented less than it should be.
The first line in docstrings should read like a command.
Line contains tabs when only spaces are expected.
Line contains an inline comment that does not have 2 spaces before it.
Module (the term for the Python file) should have a docstring.
Too many blank lines.
Line contains a {character} that has a space before it.
Files should end with a newline.
Line contains a {character} that has a space before it.
There should be 1 blank line between the summary line and the description.
Variables in functions should be lowercase.
Line has an indentation level that is not a multiple of four.
Line has too many indentation levels.
Comments have a space between the #
character and the comment message.
Methods should have docstrings.
Functions and classes should have two blank lines after them.
Comparisons to objects such as True
, False
, and None
should use is
or is not
instead of ==
and !=
.
Backslash is used to escape a character that cannot be escaped.
Function docstrings should not have blank lines after them.
Line is indented more than it should be.
Line is indented using a mixture of spaces and tabs.
The first word in the first line should be capitalised.
Line is not indented as far as it should be or is indented too far.
Except block is calling all exceptions, instead it should catch a specific exception.
There are either zero, two, or more than two blank lines at the end of your file.
Mixed case variable used in the global scope
Function names should be lowercase.
There is no need for a backslash (\
) between brackets.
Class should have a docstring.
Use """triple double quotes""" around docstrings.
Program failed to compile.
Docstrings that are one line long should fit on one line with quotes.
The __init__
method should have a docstring.
Text in docstrings should not be surrounded by whitespace.
Docstrings that are longer than one line should have closing quotes on a separate line.
Line contains a {character} that has a space before it.
Argument names should be lowercase.
Line contains a {character} that has a space after it.
Class docstrings should have 1 blank line after them.
Line is not indented at the correct level.
Docstring is over-indented.
Line is missing a blank line between the methods of a class.
Module imports should be at the top of the file and there should be no statements in between module level imports.
Line has multiple spaces after an operator.
Line is indented when it shouldn't be.
Line contains multiple statements.
Function docstrings should not have blank lines before them.
Line has multiple spaces before an operator.
Magic methods should have docstrings.
Comments should only start with a single #
character.
Nested definitions should have one blank line before them.
Line has a closing bracket that does not match the indentation of the opening bracket.
Line contains more than one space after a keyword.
Comparisons to objects such as True
, False
, and None
should use is
or is not
instead of ==
and !=
.
Docstring is under-indented.
Class names should use the CapWords convention.
Line is not aligned correctly for a hanging indent.
Line has the same indentation as the next logical line.
Line is missing whitespace around a modulo operator (%
).
Line contains multiple statements.
Line ends in a semicolon (;
).
Line has a continuation that should be indented one extra level so that it can be distinguished from the next logical line.
Line contains imports from different modules on the same line.
Line uses one of the variables named l
, O
, or I
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
.
<>
has been removed in Python 3.
Change outer quotes to avoid escaping inner quotes.
Line is indented when it shouldn't be.
Line is not indented at the correct level.
Class docstrings should not have blank lines before them.
Line contains more than one space before a keyword.
Line contains a blank line after a function decorator.
Public nested classes should have docstrings.
Docstrings should be indented using spaces, not tabs.
Mixed case variable used in the class scope
Use r""" if there are any backslashes in a docstring.
Import that should have been imported as camelCase has been imported as lowercase.
The first line in docstrings should not be a copy of the function’s definition.
Sections in docstrings must have content.
Line contains a tab character after an operator.
The first argument of a method should be named self
.
Line assigns a lambda expression instead of defining it as a function using def
.
Import that should have been imported as lowercase has been imported as non lowercase
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.
Line is missing whitespace around a bitwise or shift operator (<<
, >>
, &
, |
, ^
).
There should be no blank lines between a section header and its content.
Line contains a tab character before an operator.
Import that should have been imported as camelCase has been imported as an acronym.
Line contains a tab character after a keyword.
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.
Line contains a function named l
, O
, or I
The first argument of a classmethod should be named cls
.
Function names should not start and end with __
(double underscore).
You should compare an objects type by using isinstance()
instead of ==
. This is because isinstance
can handle subclasses as well.
.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 is missing a space after a keyword.
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.