Inspectopedia Help

Python

A byte literal contains a non-ASCII character   New in this release

Reports characters in byte literals that are outside ASCII range.

Accessing a protected member of a class or a module   New in this release

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__`   New in this release

Reports a problem when instance attribute definition is outside __init__ method.

An invalid interpreter   New in this release

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   New in this release

Reports cases when an assignment is done on a function that does not return anything.

Assignment can be replaced with augmented assignment   New in this release

Reports assignments that can be replaced with augmented assignments.

Assignments to 'for' loop or 'with' statement parameter   New in this release

Reports the cases when you rewrite a loop variable with an inner loop.

Attempt to call a non-callable object   New in this release

Reports a problem when you are trying to call objects that are not callable, like, for example, properties:.

Class has no `__init__` method   New in this release

Reports cases in Python 2 when a class has no __init__ method, neither its parent classes.

Class must implement all abstract methods   New in this release

Reports cases when not all abstract properties or methods are defined in a subclass.

Class-specific decorator is used outside the class   New in this release

Reports usages of @classmethod or @staticmethod decorators in methods outside a class.

Classic style class usage   New in this release

Reports classic style classes usage.

Code is incompatible with specific Python versions   New in this release

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   New in this release

Reports usages of Python functions, or methods that are marked as deprecated and raise the DeprecationWarning or PendingDeprecationWarning warning.

Dictionary contains duplicate keys   New in this release

Reports using the same value as the dictionary key twice.

Dictionary creation can be rewritten by dictionary literal   New in this release

Reports situations when you can rewrite dictionary creation by using a dictionary literal.

Errors in string formatting operations   New in this release

Reports errors in string formatting operations.

Exceptions do not inherit from standard 'Exception' class   New in this release

Reports cases when a custom exception class is raised but does not inherit from the builtin Exception class.

File contains non-ASCII character   New in this release

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   New in this release

Reports cases when the first parameter, such as self or cls, is reassigned in a method.

Fixture is not requested by test functions   New in this release

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   New in this release

Reports calls to the set function that can be replaced with the set literal.

Global variable is not defined at the module level   New in this release

Reports problems when a variable defined through the global statement is not defined in the module scope.

Improper first parameter   New in this release

Reports methods that lack the first parameter that is usually named self.

Improper position of from __future__ import   New in this release

Reports from __future__ import statements that are used not at the beginning of a file.

Inappropriate access to properties   New in this release

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__   New in this release

Reports incompatible signatures of the __new__ and __init__ methods.

Incompatible stub packages   New in this release

Reports stub packages that do not support the version of the corresponding runtime package.

Inconsistent indentation   New in this release

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   New in this release

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   New in this release

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   New in this release

Reports discrepancies between declared parameters and actual arguments, as well as incorrect arguments, for example, duplicate named arguments, and incorrect argument order.

Incorrect docstring   New in this release

Reports mismatched parameters in a docstring.

Incorrect property definition   New in this release

Reports problems with the arguments of property() and functions annotated with @property.

Incorrect type   New in this release

Reports type errors in function call expressions, targets, and return values.

Invalid TypedDict definition and usages   New in this release

Reports invalid definition and usage of TypedDict.

Invalid definition and usage of Data Classes   New in this release

Reports invalid definitions and usages of classes created with dataclasses or attr modules.

Invalid definition of 'typing.NamedTuple'   New in this release

Reports invalid definition of a typing.NamedTuple.

Invalid protocol definitions and usages   New in this release

Reports invalid definitions and usages of protocols introduced in PEP-544.

Invalid type hints definitions and usages   New in this release

Reports invalid usages of type hints.

Invalid usage of ClassVar variables   New in this release

Reports invalid usages of ClassVar annotations.

Invalid usage of new-style type parameters and type aliases   New in this release

Reports invalid usage of PEP 695 type parameter syntax.

Invalid usages of @override decorator   New in this release

Reports when a method decorated with @override doesn't have a matching method in its ancestor classes.

Invalid usages of classes with '__slots__' definitions   New in this release

Reports invalid usages of a class with __slots__ definitions.

Invalid usages of final classes, methods, and variables   New in this release

Reports invalid usages of final classes, methods and variables.

Method Series.to_list() is recommended   New in this release

Reports redundant list in list(Series.values) statement for pandas and polars libraries.

Method is not declared static   New in this release

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   New in this release

Reports inconsistencies in overriding method signatures.

Missed call to '__init__' of the super class   New in this release

Reports cases when a call to the super constructor in a class is missed.

Missing `await` syntax in coroutine calls   New in this release

Reports coroutines that were called without using the await syntax.

Missing or empty docstring   New in this release

Reports missing and empty docstrings.

Missing type hinting for function definition   New in this release

Reports missing type hints for function declaration in one of the two formats: parameter annotations or a type comment.

No encoding specified for file   New in this release

Reports a missing encoding comment in Python 2.

Non-optimal list declaration   New in this release

Reports cases when a list declaration can be rewritten with a list literal.

Old-style class contains new-style class features   New in this release

Reports occurrences of new-style class features in old-style classes.

Overloads in regular Python files   New in this release

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   New in this release

Reports violations of the PEP 8 coding style guide by running the bundled pycodestyle.py tool.

PEP 8 naming convention violation   New in this release

Reports violations of the PEP8 naming conventions.

Poetry package versions   New in this release

Reports outdated versions of packages in [tool.poetry.dependencies] and [tool.poetry.dev-dependencies] sections of pyproject.toml.

Problematic nesting of decorators   New in this release

Reports problems with nesting decorators.

Prohibited trailing semicolon in a statement   New in this release

Reports trailing semicolons in statements.

Redeclared names without usages   New in this release

Reports unconditional redeclarations of names without being used in between.

Redundant boolean variable check   New in this release

Reports equality comparison with a boolean literal.

Redundant parentheses   New in this release

Reports about redundant parentheses in expressions.

Shadowing built-in names   New in this release

Reports shadowing built-in names, such as len or list.

Shadowing names from outer scopes   New in this release

Reports shadowing names defined in outer scopes.

Single quoted docstring   New in this release

Reports docstrings that do not adhere to the triple double-quoted string format.

Statement has no effect   New in this release

Reports statements that have no effect.

Stub packages advertiser   New in this release

Reports availability of stub packages.

Suspicious relative imports   New in this release

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   New in this release

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   New in this release

Reports a problem when an argument passed to the function is equal to the default parameter value.

Too complex chained comparisons   New in this release

Reports chained comparisons that can be simplified.

Tuple assignment balance is incorrect   New in this release

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   New in this release

Reports assignments to a tuple item.

Type in docstring does not match inferred type   New in this release

Reports types in docstring that do not match dynamically inferred types.

Unbound local variables   New in this release

Reports local variables referenced before assignment.

Unclear exception clauses   New in this release

Reports exception clauses that do not provide specific information about the problem.

Unnecessary backslash   New in this release

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   New in this release

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   New in this release

Reports local variables, parameters, and functions that are locally defined, but not used name in a function.

Using equality operators to compare with None   New in this release

Reports comparisons with None.

Wrong arguments to call super   New in this release

Reports cases when any call to super(A, B) does not meet the following requirements:.

Wrong order of 'except' clauses   New in this release

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   New in this release

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

Last modified: 18 June 2024