Python
- A byte literal contains a non-ASCII character
Reports characters in byte literals that are outside ASCII range.
- Accessing a protected member of a class or a module
Reports cases when a protected member is accessed outside the class, a descendant of the class where it is defined, or a module.
- An instance attribute is defined outside `__init__`
Reports a problem when instance attribute definition is outside __init__ method.
- An invalid interpreter
Reports problems if there is no Python interpreter configured for the project or if the interpreter is invalid.
- Assigning function calls that don't return anything
Reports cases when an assignment is done on a function that does not return anything.
- Assignment can be replaced with augmented assignment
Reports assignments that can be replaced with augmented assignments.
- Assignments to 'for' loop or 'with' statement parameter
Reports the cases when you rewrite a loop variable with an inner loop.
- Attempt to call a non-callable object
Reports a problem when you are trying to call objects that are not callable, like, for example, properties:.
- Class has no `__init__` method
Reports cases in Python 2 when a class has no __init__ method, neither its parent classes.
- Class must implement all abstract methods
Reports cases when not all abstract properties or methods are defined in a subclass.
- Class-specific decorator is used outside the class
Reports usages of @classmethod or @staticmethod decorators in methods outside a class.
- Classic style class usage
Reports classic style classes usage.
- Code is incompatible with specific Python versions
Reports incompatibility with the specified versions of Python.
- Cython variable is used before its declaration
Reports Cython variables being referenced before declaration.
- Deprecated function, class, or module
Reports usages of Python functions, or methods that are marked as deprecated and raise the DeprecationWarning or PendingDeprecationWarning warning.
- Dictionary contains duplicate keys
Reports using the same value as the dictionary key twice.
- Dictionary creation can be rewritten by dictionary literal
Reports situations when you can rewrite dictionary creation by using a dictionary literal.
- Errors in string formatting operations
Reports errors in string formatting operations.
- Exceptions do not inherit from standard 'Exception' class
Reports cases when a custom exception class is raised but does not inherit from the builtin Exception class.
- File contains non-ASCII character
Reports cases in Python 2 when a file contains non-ASCII characters and does not have an encoding declaration at the top.
- First argument of the method is reassigned
Reports cases when the first parameter, such as self or cls, is reassigned in a method.
- Fixture is not requested by test functions
Reports if a fixture is used without being passed to test function parameters or to @pytest.mark.usefixtures decorator.
- Function call can be replaced with set literal
Reports calls to the set function that can be replaced with the set literal.
- Global variable is not defined at the module level
Reports problems when a variable defined through the global statement is not defined in the module scope.
- Improper first parameter
Reports methods that lack the first parameter that is usually named self.
- Improper position of from __future__ import
Reports from __future__ import statements that are used not at the beginning of a file.
- Inappropriate access to properties
Reports cases when properties are accessed inappropriately: Read-only properties are set Write-only properties are read Non-deletable properties are deleted Example: class MyClass: @property def read_only(self): return None def __write_only_setter(self, value): pass write_only = property(None, __write_only_setter) a = MyClass() a.read_only = 10 # property cannot be set del a.read_only # property cannot be deleted print(a.write_only) # property cannot be read.
- Incompatible signatures of __new__ and __init__
Reports incompatible signatures of the __new__ and __init__ methods.
- Incompatible stub packages
Reports stub packages that do not support the version of the corresponding runtime package.
- Inconsistent indentation
Reports inconsistent indentation in Python source files when, for example, you use a mixture of tabs and spaces in your code.
- Incorrect BDD Behave-specific definitions
Reports incorrect usages of Python Behave BDD framework:.
- Incorrect CLI syntax
Reports the problems if the arguments of the command you type in the console are not in the proper order.
- Incorrect arguments in @pytest.mark.parametrize
Reports functions that are decorated with @pytest.mark.parametrize but do not have arguments to accept parameters of the decorator.
- Incorrect arguments in step definition functions
Reports incorrect arguments in step definition functions.
- Incorrect call arguments
Reports discrepancies between declared parameters and actual arguments, as well as incorrect arguments, for example, duplicate named arguments, and incorrect argument order.
- Incorrect docstring
Reports mismatched parameters in a docstring.
- Incorrect property definition
Reports problems with the arguments of property() and functions annotated with @property.
- Incorrect type
Reports type errors in function call expressions, targets, and return values.
- Invalid TypedDict definition and usages
Reports invalid definition and usage of TypedDict.
- Invalid definition and usage of Data Classes
Reports invalid definitions and usages of classes created with dataclasses or attr modules.
- Invalid definition of 'typing.NamedTuple'
Reports invalid definition of a typing.NamedTuple.
- Invalid protocol definitions and usages
Reports invalid definitions and usages of protocols introduced in PEP-544.
- Invalid type hints definitions and usages
Reports invalid usages of type hints.
- Invalid usage of ClassVar variables
Reports invalid usages of ClassVar annotations.
- Invalid usage of new-style type parameters and type aliases
Reports invalid usage of PEP 695 type parameter syntax.
- Invalid usages of @override decorator
Reports when a method decorated with @override doesn't have a matching method in its ancestor classes.
- Invalid usages of classes with '__slots__' definitions
Reports invalid usages of a class with __slots__ definitions.
- Invalid usages of final classes, methods, and variables
Reports invalid usages of final classes, methods and variables.
- Method Series.to_list() is recommended
Reports redundant list in list(Series.values) statement for pandas and polars libraries.
- Method is not declared static
Reports any methods that do not require a class instance creation and can be made static.
- Method signature does not match signature of overridden method
Reports inconsistencies in overriding method signatures.
- Missed call to '__init__' of the super class
Reports cases when a call to the super constructor in a class is missed.
- Missing `await` syntax in coroutine calls
Reports coroutines that were called without using the await syntax.
- Missing or empty docstring
Reports missing and empty docstrings.
- Missing type hinting for function definition
Reports missing type hints for function declaration in one of the two formats: parameter annotations or a type comment.
- No encoding specified for file
Reports a missing encoding comment in Python 2.
- Non-optimal list declaration
Reports cases when a list declaration can be rewritten with a list literal.
- Old-style class contains new-style class features
Reports occurrences of new-style class features in old-style classes.
- Overloads in regular Python files
Reports cases when overloads in regular Python files are placed after the implementation or when their signatures are not compatible with the implementation.
- PEP 8 coding style violation
Reports violations of the PEP 8 coding style guide by running the bundled pycodestyle.py tool.
- PEP 8 naming convention violation
Reports violations of the PEP8 naming conventions.
- Poetry package versions
Reports outdated versions of packages in [tool.poetry.dependencies] and [tool.poetry.dev-dependencies] sections of pyproject.toml.
- Problematic nesting of decorators
Reports problems with nesting decorators.
- Prohibited trailing semicolon in a statement
Reports trailing semicolons in statements.
- Redeclared names without usages
Reports unconditional redeclarations of names without being used in between.
- Redundant boolean variable check
Reports equality comparison with a boolean literal.
- Redundant parentheses
Reports about redundant parentheses in expressions.
- Shadowing built-in names
Reports shadowing built-in names, such as len or list.
- Shadowing names from outer scopes
Reports shadowing names defined in outer scopes.
- Single quoted docstring
Reports docstrings that do not adhere to the triple double-quoted string format.
- Statement has no effect
Reports statements that have no effect.
- Stub packages advertiser
Reports availability of stub packages.
- Suspicious relative imports
Reports usages of relative imports inside plain directories, for example, directories neither containing __init__.py nor explicitly marked as namespace packages.
- The default argument is mutable
Reports a problem when a mutable value as a list or dictionary is detected in a default value for an argument.
- The function argument is equal to the default parameter value
Reports a problem when an argument passed to the function is equal to the default parameter value.
- Too complex chained comparisons
Reports chained comparisons that can be simplified.
- Tuple assignment balance is incorrect
Reports cases when the number of expressions on the right-hand side and targets on the left-hand side are not the same.
- Tuple item assignment is prohibited
Reports assignments to a tuple item.
- Type in docstring does not match inferred type
Reports types in docstring that do not match dynamically inferred types.
- Unbound local variables
Reports local variables referenced before assignment.
- Unclear exception clauses
Reports exception clauses that do not provide specific information about the problem.
- Unnecessary backslash
Reports backslashes in places where line continuation is implicit inside (), [], and {}.
- Unreachable code
Reports code fragments that cannot be normally reached.
- Unresolved references
Reports references in your code that cannot be resolved.
- Unsatisfied package requirements
Reports packages mentioned in requirements files (for example, requirements.txt or Pipfile) but not installed, or imported but not mentioned in requirements files.
- Unused local symbols
Reports local variables, parameters, and functions that are locally defined, but not used name in a function.
- Using equality operators to compare with None
Reports comparisons with None.
- Wrong arguments to call super
Reports cases when any call to super(A, B) does not meet the following requirements:.
- Wrong order of 'except' clauses
Reports cases when except clauses are not in the proper order, from the more specific to the more generic, or one exception class is caught twice.
- __init__ method that returns a value
Reports occurrences of return statements with a return value inside __init__ methods of classes.
- Security
Sub-group of 1 inspection that provides checks for Security