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