mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Update python inspections' descriptions (PY-48274)
GitOrigin-RevId: 4ee6b7ef7e51a697e4d52a06b87cf599c79366a0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1f898d43af
commit
cf78619d36
@@ -1,5 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights unresolved buildout parts.
|
||||
<p>Reports unresolved references in the <code>parts</code> option of the Buildout configuration file.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<html>
|
||||
<body>
|
||||
<strong>Command line (commands, arguments and options) inspection.</strong>
|
||||
<p>This inspection checks command you type in command console or command file. It helps you to make sure arguments are on their
|
||||
places, option names are correct as well as arguments, provided for options.</p>
|
||||
<p>Do not disable it if you are going to use command-line interfaces like manage.py in Django</p>
|
||||
<p>Reports the problems if the arguments of the command you type in the console are not in the proper order. The inspection also verifies
|
||||
that option names and arguments are correct.</p>
|
||||
<p>Do not disable the inspection if you are going to use command-line interfaces like <a
|
||||
href="https://www.jetbrains.com/help/pycharm/running-manage-py.html">manage.py in Django</a>.</p>
|
||||
</body>
|
||||
</html>
|
||||
+9
-1
@@ -1,5 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection warns about Cython variables being referenced before declaration.
|
||||
<p>Reports Cython variables being referenced before declaration.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
cdef int c_x
|
||||
|
||||
print(c_x, c_y) # Variable 'c_y' is used before its declaration
|
||||
|
||||
cdef int c_y = 0
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection runs the bundled <a href="https://github.com/PyCQA/pycodestyle">pycodestyle.py</a> tool
|
||||
to check for violations of the PEP 8 coding style guide.
|
||||
<p>
|
||||
See <a href="https://www.python.org/dev/peps/pep-0008/">PEP 8</a> for more details.
|
||||
</p>
|
||||
<p>Reports violations of the <a href="https://www.python.org/dev/peps/pep-0008/">PEP 8 coding style guide</a> by running the bundled <a
|
||||
href="https://github.com/PyCQA/pycodestyle">pycodestyle.py</a> tool.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +1,23 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection checks the PEP8 naming conventions.
|
||||
<p>
|
||||
See <a href="https://www.python.org/dev/peps/pep-0008/">PEP 8</a> for more details.
|
||||
</p>
|
||||
<p>Reports violations of the
|
||||
<a href="https://www.python.org/dev/peps/pep-0008/">PEP8</a> naming conventions.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class mammalia(object):
|
||||
extremities = 4
|
||||
|
||||
def feeds(self):
|
||||
print("milk")
|
||||
</pre>
|
||||
<p>In this code fragment, IDE offers to rename <code>mammalia</code> to <code>Mammalia</code>.
|
||||
When the quick-fix is applied, the code change to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class Mammalia(object):
|
||||
extremities = 4
|
||||
|
||||
def feeds(self):
|
||||
print("milk")
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection reports usages of relative imports inside plain directories, i.e. directories neither containing __init__.py nor explicitly marked as namespace packages.
|
||||
<p>Reports usages of relative imports inside plain directories, for example, directories neither containing <code>__init__.py</code> nor
|
||||
explicitly marked as namespace packages.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects shadowing built-in names, such as 'len' or 'list'.
|
||||
<p>Reports shadowing built-in names, such as <code>len</code> or <code>list</code>.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def len(a, b, c):
|
||||
d = a + b + c
|
||||
return d
|
||||
</pre>
|
||||
<p>In this code fragment, the <code>len</code> built-in name is used. The IDE offers to
|
||||
apply the Rename refactoring as a fix.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +1,10 @@
|
||||
<html>
|
||||
<body>
|
||||
Advertises stub packages.
|
||||
<p>Reports availability of stub packages.</p>
|
||||
<p>
|
||||
Stub package is a package that contains type information for the corresponding runtime package.
|
||||
See <a href="https://www.python.org/dev/peps/pep-0561/">PEP 561</a> for more details.
|
||||
<a href="https://www.python.org/dev/peps/pep-0561/">Stub package</a> is a package that contains type information for the corresponding
|
||||
runtime package.
|
||||
</p>
|
||||
<p>Using stub packages ensures better coding assistance for the corresponding python package.</p>
|
||||
</body>
|
||||
</html>
|
||||
+2
-4
@@ -1,8 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Checks that a stub package supports the version of the corresponding runtime package.
|
||||
<p>
|
||||
Stub package is a package that contains type information for some runtime package.
|
||||
See <a href="https://www.python.org/dev/peps/pep-0561/">PEP 561</a> for more details.
|
||||
<p>Reports stub packages that do not support the version of the corresponding runtime package.</p>
|
||||
<p>A <a href="https://www.python.org/dev/peps/pep-0561/">stub package</a> contains type information for some runtime package.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Test function, decorated with @pytest.mark.parametrize, must have arguments to accept parameters from decorator
|
||||
<p>Reports functions that are decorated with <a href="https://docs.pytest.org/en/stable/parametrize.html">
|
||||
@pytest.mark.parametrize</a> but do not have arguments to accept
|
||||
parameters of the decorator.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+10
-3
@@ -1,7 +1,14 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects names that should resolve but don't.
|
||||
Due to dynamic dispatch and duck typing, this is possible in a limited but useful
|
||||
number of cases. Top-level and class-level items are supported better than instance items.
|
||||
<p>Reports references in your code that cannot be resolved.</p>
|
||||
<p>In a dynamically typed language, this is possible in a limited number of cases. </p>
|
||||
<p>If a reference type is unknown, then its attributes are not highlighted as unresolved even if you know that they should be:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def print_string(s):
|
||||
print(s.abc())
|
||||
</pre>
|
||||
<p>In this code fragment <code>s</code> is always a string and <code>abc</code> should be highlighted as unresolved. However, <code>s</code>
|
||||
type is inferred as <code>Any</code> and no warning is reported.</p>
|
||||
<p>The IDE provides quick-fix actions to add missing references on-the-fly.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects undefined roles.
|
||||
<p>Reports undefined roles in reStructuredText files.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
.. role:: custom
|
||||
.. role:: newcustom(emphasis)
|
||||
|
||||
An example of using :custom:`interpreted text`
|
||||
An example of using :newcustom:`interpreted text`
|
||||
An example of using :emphasis:`interpreted text`
|
||||
|
||||
|
||||
Some text using undefined role :undef:`interpreted text`
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -319,7 +319,7 @@ python.console.not.supported=Python console for {0} interpreter is not supported
|
||||
|
||||
#Buildout
|
||||
buildout=Buildout
|
||||
buildout.unresolved.part.inspection=Buildout config unresolved part inspection
|
||||
buildout.unresolved.part.inspection=Unresolved parts of Buildout config
|
||||
buildout.unresolved.part.inspection.msg=Unresolved part reference
|
||||
buildout.configurable.enable.buildout.support.checkbox.text=&Enable buildout support
|
||||
runcfg.unittest.dlg.test_function_title=Function
|
||||
@@ -490,7 +490,7 @@ remote.interpreter.remote.server.permissions=Failed to browse the remote server.
|
||||
remote.interpreter.accessing.remote.interpreter.progress.title=Accessing Remote Interpreter
|
||||
|
||||
# CommandLine
|
||||
commandLine.inspection.name=Command-line inspection
|
||||
commandLine.inspection.name=Incorrect CLI syntax
|
||||
commandLine.inspection.badCommand=Bad or unknown command. Ensure this command exists.
|
||||
commandLine.inspection.badOption=Bad or unknown option. Ensure this option exists.
|
||||
commandLine.inspection.badArgument=Argument cannot have this value. Use autocompletion to check the list of possible values.
|
||||
@@ -1121,8 +1121,8 @@ python.execution.is.still.running=Previous execution is still running
|
||||
|
||||
INSP.settings.pep8.ignore.errors=Ignore Errors
|
||||
INSP.settings.pep8.ignore.errors.label=Ignored errors:
|
||||
INSP.settings.bdd.behave.specific=BDD Behave-specific inspection
|
||||
INSP.settings.bdd.step.definition.arguments=BDD step definition arguments inspection
|
||||
INSP.settings.bdd.behave.specific=Incorrect BDD Behave-specific definitions
|
||||
INSP.settings.bdd.step.definition.arguments=Incorrect arguments in step definition functions
|
||||
python.compatibility.inspection.advertiser.notifications.group.title=Python compatibility inspection advertiser
|
||||
python.compatibility.inspection.advertiser.notifications.title=Python versions compatibility
|
||||
|
||||
|
||||
+37
-1
@@ -1,5 +1,41 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects when not all abstract properties/methods are defined in a subclass
|
||||
<p>Reports cases when not all abstract properties or methods are defined in
|
||||
a subclass.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
from abc import abstractmethod, ABC
|
||||
|
||||
|
||||
class Figure(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def do_figure(self):
|
||||
pass
|
||||
|
||||
|
||||
class Triangle(Figure):
|
||||
def do_triangle(self):
|
||||
pass
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the IDE implements an abstract method for the <code>Triangle</code> class:</p>
|
||||
<pre style="font-family: monospace">
|
||||
from abc import abstractmethod, ABC
|
||||
|
||||
|
||||
class Figure(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def do_figure(self):
|
||||
pass
|
||||
|
||||
|
||||
class Triangle(Figure):
|
||||
def do_figure(self):
|
||||
pass
|
||||
|
||||
def do_triangle(self):
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+11
-1
@@ -1,5 +1,15 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights situations, where argument passed to function is equal to default parameter value
|
||||
<p>Reports a problem when an argument
|
||||
passed to the function is equal to the default parameter value.</p>
|
||||
<p>This inspection is disabled by default to avoid performance degradation.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def my_function(a: int = 2):
|
||||
print(a)
|
||||
|
||||
|
||||
my_function(2)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+24
-2
@@ -1,6 +1,28 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports discrepancies between declared parameters and actual arguments, as well as
|
||||
incorrect arguments (e.g. duplicate named arguments) and incorrect argument order. Decorators are analyzed, too.
|
||||
<p>Reports discrepancies between declared parameters and actual arguments, as well as
|
||||
incorrect arguments, for example, duplicate named arguments, and incorrect argument order.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Foo:
|
||||
def __call__(self, p1: int, *, p2: str = "%"):
|
||||
return p2 * p1
|
||||
|
||||
|
||||
bar = Foo()
|
||||
bar.__call__() # unfilled parameter
|
||||
bar(5, "#") # unexpected argument
|
||||
</pre>
|
||||
<p>The correct code fragment looks at follows:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class Foo:
|
||||
def __call__(self, p1: int, *, p2: str = "%"):
|
||||
return p2 * p1
|
||||
|
||||
|
||||
bar = Foo()
|
||||
bar.__call__(5)
|
||||
bar(5, p2="#")
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
<html>
|
||||
<body>
|
||||
Checks for cases when you rewrite loop variable with inner loop
|
||||
Reports the cases when you rewrite a loop variable with an inner loop:
|
||||
<pre style="font-family: monospace">
|
||||
for i in xrange(5):
|
||||
for i in xrange(20, 25):
|
||||
for i in range(5):
|
||||
for i in range(20, 25):
|
||||
print("Inner", i)
|
||||
print("Outer", i)
|
||||
</pre>
|
||||
|
||||
It also warns you if variable declared in <code>with</code> statement is redeclared inside of statement body:
|
||||
It also warns you if a variable declared in the <code>with</code> statement is redeclared inside of the statement body:
|
||||
<pre style="font-family: monospace">
|
||||
with open("file") as f:
|
||||
f.read()
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights coroutines which were called without await
|
||||
<p>Reports coroutines that were called
|
||||
without using the <code>await</code> syntax.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
async def bar():
|
||||
pass
|
||||
|
||||
|
||||
async def foo():
|
||||
bar()
|
||||
</pre>
|
||||
<p>After the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
async def bar():
|
||||
pass
|
||||
|
||||
|
||||
async def foo():
|
||||
await bar()
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+23
-1
@@ -1,5 +1,27 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects instance attribute definition outside __init__ method
|
||||
Reports a problem when instance attribute
|
||||
definition is outside <code>__init__</code> method.
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Book:
|
||||
def __init__(self):
|
||||
self.author = 'Mark Twain'
|
||||
|
||||
def release(self):
|
||||
self.year = '1889'
|
||||
</pre>
|
||||
<p>
|
||||
When the quick-fix is applied, the code sample changes to:
|
||||
</p>
|
||||
<pre style="font-family: monospace">
|
||||
class Book:
|
||||
def __init__(self):
|
||||
self.year = '1889'
|
||||
self.author = 'Mark Twain'
|
||||
|
||||
def release(self):
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+13
-1
@@ -1,5 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights assignment that can be replaced with augmented assignment.
|
||||
<p>Reports assignments that can be replaced with augmented assignments.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
a = 23
|
||||
b = 3
|
||||
a = a + b
|
||||
</pre>
|
||||
<p>After the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
a = 23
|
||||
b = 3
|
||||
a += b
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+7
-2
@@ -1,6 +1,11 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights too broad exception clauses such as
|
||||
no exception class specified, or specified as 'Exception'.
|
||||
<p>Reports exception clauses that do not provide specific information
|
||||
about the problem. </p>
|
||||
<p><b>Example:</b></p>
|
||||
<ul>
|
||||
<li>Clauses that do not specify an exception class</li>
|
||||
<li>Clauses that are specified as <code>Exception</code></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects characters > 255 in byte literals.
|
||||
<p>Reports characters in byte literals that are outside ASCII range.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<code>s = b'№5'</code>
|
||||
</body>
|
||||
</html>
|
||||
+9
-1
@@ -1,5 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights attempts to call objects which are not callable, like, for example, tuples.
|
||||
<p>Reports a problem when you are trying
|
||||
to call objects that are not callable, like, for example, properties:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class Record:
|
||||
@property
|
||||
def as_json(self):
|
||||
|
||||
json = Record().as_json()
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+18
-1
@@ -1,5 +1,22 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights chained comparisons that can be simplified.
|
||||
<p>Reports chained comparisons that can be simplified.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def do_comparison(x):
|
||||
xmin = 10
|
||||
xmax = 100
|
||||
if x >= xmin and x <= xmax:
|
||||
pass
|
||||
</pre>
|
||||
<p>The IDE offers to simplify <code>if x >= xmin and x <= xmax</code>.
|
||||
When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def do_comparison(x):
|
||||
xmin = 10
|
||||
xmax = 100
|
||||
if xmin <= x <= xmax:
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+13
-1
@@ -1,5 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection used when a class has no __init__ method, neither its parent classes.
|
||||
<p>Reports cases in Python 2 when a class has no <code>__init__</code> method, neither its parent
|
||||
classes.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Book():
|
||||
pass
|
||||
</pre>
|
||||
<p>The quick-fix adds the <code>__init__</code> method:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class Book():
|
||||
def __init__(self):
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+13
-1
@@ -1,5 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects classic style classes usage.
|
||||
<p>Reports <a href="https://docs.python.org/2/reference/datamodel.html#new-style-and-classic-classes">
|
||||
classic style classes</a> usage. This inspection applies only to Python 2.
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class A:
|
||||
pass
|
||||
</pre>
|
||||
<p>With quick-fixes provided by the IDE, this code fragment changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class A(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+19
-2
@@ -1,6 +1,23 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights comparisons with None. That type of comparisons
|
||||
should always be done with 'is' or 'is not', never the equality operators.
|
||||
<p>Reports comparisons with <code>None</code>. That type of comparisons
|
||||
should always be done with <code>is</code> or <code>is not</code>, never
|
||||
the equality operators.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
a = 2
|
||||
|
||||
|
||||
if a == None:
|
||||
print("Success")
|
||||
</pre>
|
||||
<p>Once the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
a = 2
|
||||
|
||||
|
||||
if a is None:
|
||||
print("Success")
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+7
-3
@@ -1,7 +1,11 @@
|
||||
<html>
|
||||
<body>
|
||||
Enable this inspection if you need your code to be compatible with a range of Python versions (for example, if you're building a
|
||||
library).
|
||||
The range of Python versions with which the code needs to be compatible can be specified in the inspection settings.
|
||||
<p>Reports incompatibility with the specified versions of Python.
|
||||
Enable this inspection if you need your code to be compatible with a range of Python versions, for example,
|
||||
if you are building a library.</p>
|
||||
<p>To define the range of the inspected Python versions, select the corresponding checkboxes in the <b>Options</b>
|
||||
section.</p>
|
||||
<p>For more information about the Python versions supported by the IDE, see the
|
||||
<a href="https://www.jetbrains.com/help/pycharm/python.html#support">web help</a>.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects invalid definitions and usages of classes created with `dataclasses` or `attr` modules.
|
||||
<p>Reports invalid definitions and usages of classes created with
|
||||
<code>dataclasses</code> or <code>attr</code> modules.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
import dataclasses
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class FullName:
|
||||
first: str
|
||||
middle: str = ""
|
||||
last: str
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,33 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports usages of @classmethod or @staticmethod decorators on functions outside of a class.
|
||||
<p>Reports usages of <code>@classmethod</code> or <code>@staticmethod</code> decorators
|
||||
in methods outside a class.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class State(object):
|
||||
|
||||
@classmethod
|
||||
def my_state(cls, name):
|
||||
cls.name = name
|
||||
|
||||
|
||||
@classmethod
|
||||
def change_state(self):
|
||||
pass
|
||||
</pre>
|
||||
<p>The <code>change_state</code> method should not use the <code>@classmethod</code> decorator or it should be
|
||||
moved to the <code>State</code> class declaration. </p>
|
||||
<p>If you apply the <code>Remove decorator</code> action, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class State(object):
|
||||
|
||||
@classmethod
|
||||
def my_state(cls, name):
|
||||
cls.name = name
|
||||
|
||||
|
||||
def change_state(self):
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+17
-3
@@ -1,7 +1,21 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects when a mutable value as list or dictionary is detected in a default value for an argument. <br/>
|
||||
Default argument values are evaluated only once at function definition time, which means that modifying the
|
||||
default value of the argument will affect all subsequent calls of the function.
|
||||
<p>Reports a problem when a mutable value as a list or dictionary is detected in a default value for
|
||||
an argument. <br/>
|
||||
Default argument values are evaluated only once at function definition time,
|
||||
which means that modifying the
|
||||
default value of the argument will affect all subsequent calls of that function.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def func(s, cache={}):
|
||||
cache[s] = None
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def func(s, cache=None):
|
||||
if cache is None:
|
||||
cache = {}
|
||||
cache[s] = None
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+17
-2
@@ -1,6 +1,21 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights usages of Python functions, classes or methods which are marked as deprecated (which raise a
|
||||
DeprecationWarning or a PendingDeprecationWarning).
|
||||
<p>Reports usages of Python functions, or methods that are marked as
|
||||
deprecated and raise the <code>DeprecationWarning</code> or <code>PendingDeprecationWarning</code> warning.</p>
|
||||
<p>Also, this inspection highlights usages of <code>abc.abstractstaticmethod</code>, <code>abc.abstractproperty</code>, and <code>abc.abstractclassmethod</code>
|
||||
decorators.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Foo:
|
||||
@property
|
||||
def bar(self):
|
||||
import warnings
|
||||
warnings.warn("this is deprecated", DeprecationWarning, 2)
|
||||
return 5
|
||||
|
||||
|
||||
foo = Foo()
|
||||
print(foo.bar)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+12
-2
@@ -1,6 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects situations when dictionary creation
|
||||
could be rewritten with dictionary literal.
|
||||
<p>Reports situations when you can rewrite dictionary creation
|
||||
by using a dictionary literal.</p>
|
||||
<p>This approach brings performance improvements.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
dic = {}
|
||||
dic['var'] = 1
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
dic = {'var': 1}
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+5
-1
@@ -1,5 +1,9 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights using the same value as dictionary key twice.
|
||||
<p>Reports using the same value as the dictionary key twice.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
dic = {"a": [1, 2], "a": [3, 4]}
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights types in docstring which don't match dynamically inferred types.
|
||||
<p>Reports types in docstring that do not match dynamically inferred types.</p>
|
||||
</body>
|
||||
</html>
|
||||
+10
-1
@@ -1,5 +1,14 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects invalid definition of __slots__ in a class.
|
||||
<p>Reports invalid usages of a class with <code>__slots__</code> definitions.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Foo:
|
||||
__slots__ = ['foo', 'bar']
|
||||
|
||||
|
||||
foo = Foo()
|
||||
foo.baz = 'spam'
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+23
-3
@@ -1,7 +1,27 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights situations when except clauses are not in the correct order
|
||||
(from the more specific to the more generic) or one exception class is caught twice. <br/>
|
||||
If you don't fix the order, some exceptions may not be catched by the most specific handler.
|
||||
<p>Reports cases when <code>except</code> clauses are not in the proper order,
|
||||
from the more specific to the more generic, or one exception class is caught twice. </p>
|
||||
<p>
|
||||
If you do not fix the order, some exceptions may not be caught by the most specific handler.
|
||||
</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
try:
|
||||
call()
|
||||
except ValueError:
|
||||
pass
|
||||
except UnicodeError:
|
||||
pass
|
||||
</pre>
|
||||
<p>The IDE recommends moving the clause up. When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
try:
|
||||
call()
|
||||
except UnicodeError:
|
||||
pass
|
||||
except ValueError:
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+21
-1
@@ -1,5 +1,25 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects when a custom exception class is raised but doesn't inherit from the builtin "Exception" class.
|
||||
<p>Reports cases when a custom exception class is
|
||||
raised but does not inherit from the
|
||||
<a href="https://docs.python.org/3/library/exceptions.html">builtin Exception class</a>.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class A:
|
||||
pass
|
||||
|
||||
|
||||
def me_exception():
|
||||
raise A()
|
||||
</pre>
|
||||
<p>The proposed quick-fix changes the code to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class A(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def me_exception():
|
||||
raise A()
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,21 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects invalid usages of final classes, methods and variables.
|
||||
<p>Reports invalid usages of final classes,
|
||||
methods and variables.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
from typing import final
|
||||
|
||||
|
||||
@final
|
||||
class A:
|
||||
def a_method(self):
|
||||
pass
|
||||
|
||||
|
||||
class B(A):
|
||||
def a_method(self):
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+16
-1
@@ -1,5 +1,20 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects <code>'from __future__ import'</code> statements which are used not in the beginning of a file.
|
||||
<p>Reports <code>from __future__ import</code>
|
||||
statements that are used not at
|
||||
the beginning of a file.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
a = 1
|
||||
from __future__ import print_function
|
||||
print()
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
from __future__ import print_function
|
||||
|
||||
a = 1
|
||||
print()
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+18
-2
@@ -1,6 +1,22 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection is used when a variable is defined through the "global" statement but the variable is not defined in the module
|
||||
scope.
|
||||
<p>Reports problems when a variable defined through the <code>global</code>
|
||||
statement is not defined in the module scope.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def foo():
|
||||
global bar
|
||||
print(bar)
|
||||
|
||||
foo()
|
||||
</pre>
|
||||
<p>As a fix, you can move the global variable declaration:</p>
|
||||
<pre style="font-family: monospace">
|
||||
global bar
|
||||
|
||||
|
||||
def foo():
|
||||
print(bar)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports inconsistent indentation in Python source files (for example, use of a mixture
|
||||
of tabs and spaces).
|
||||
<p>Reports inconsistent indentation in Python source files when, for example,
|
||||
you use a mixture of tabs and spaces in your code.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+19
-2
@@ -1,6 +1,23 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects mismatched parameters in a docstring.
|
||||
Please note that it doesn't warn you of missing parameters, if none of them is mentioned in a docstring.
|
||||
<p>Reports mismatched parameters in a docstring. For example, <code>b</code> is highlighted, because there is no
|
||||
such a parameter in the <code>add</code> function.</p>
|
||||
<pre style="font-family: monospace">
|
||||
def add(a, c):
|
||||
"""
|
||||
@param a:
|
||||
@param b:
|
||||
@return:
|
||||
"""
|
||||
pass
|
||||
</pre>
|
||||
<p>The inspection does not warn you of missing parameters if none of them is mentioned in a docstring:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def mult(a, c):
|
||||
"""
|
||||
@return:
|
||||
"""
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+13
-1
@@ -1,5 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection checks mutual compatibility of <code>__new__</code> and <code>__init__</code> signatures.
|
||||
<p>Reports incompatible signatures of the <code>__new__</code> and <code>__init__</code> methods.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class MyClass(object):
|
||||
def __new__(cls, arg1):
|
||||
return super().__new__(cls)
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
</pre>
|
||||
<p>If the <code>__new__</code> and <code>__init__</code> have different arguments, then the <code>MyClass</code>
|
||||
cannot be instantiated.</p>
|
||||
<p>As a fix, the IDE offers to apply the Change Signature refactoring.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection notifies you if the current project has no Python interpreter configured or an invalid Python interpreter.
|
||||
<p>Reports problems if there is no Python interpreter configured for the project or if the interpreter is invalid. Without a properly
|
||||
configured interpreter, you cannot execute your Python scripts and benefit from some Python code insight features.</p>
|
||||
<p>The IDE provides quick access to the interpreter settings.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+12
-2
@@ -1,6 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects situations when list creation
|
||||
could be rewritten with list literal.
|
||||
<p>Reports cases when a list declaration
|
||||
can be rewritten with a list literal.</p>
|
||||
<p>This ensures better performance of your application.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
l = [1]
|
||||
l.append(2)
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
l = [1, 2]
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+14
-1
@@ -1,5 +1,18 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects lack of encoding magic comment for file.
|
||||
<p>Reports a missing encoding comment in Python 2.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Book(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the missing comment is added:</p>
|
||||
<pre style="font-family: monospace">
|
||||
# coding=utf-8
|
||||
class Book(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+14
-2
@@ -1,5 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects cases when first parameter, such as 'self' or 'cls', is reassigned in a method.
|
||||
In most cases imaginable, there's no point in such reassignment, and it indicates an error.
|
||||
<p>Reports cases when the first parameter,
|
||||
such as <code>self</code> or <code>cls</code>, is reassigned in a method.
|
||||
Because in most cases, there are no objectives in such reassignment, the
|
||||
IDE indicates an error.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Account:
|
||||
def calc(self, balance):
|
||||
if balance == 0:
|
||||
self = balance
|
||||
return self
|
||||
</pre>
|
||||
<p>As a fix, you might want to check and modify the algorithm to ensure that reassignment is needed. If everything is correct,
|
||||
you can invoke intention actions for this code and opt to ignore the warning.</p>
|
||||
</body></html>
|
||||
|
||||
+24
-1
@@ -1,5 +1,28 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects any methods which may safely be made static.
|
||||
<p>Reports any methods that do not require a class instance creation and can be
|
||||
made static.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class MyClass(object):
|
||||
def my_method(self, x):
|
||||
print(x)
|
||||
</pre>
|
||||
<p>If a <b>Make function from method</b> quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def my_method(x):
|
||||
print(x)
|
||||
|
||||
|
||||
class MyClass(object):
|
||||
pass
|
||||
</pre>
|
||||
<p>If you select the <b>Make method static</b> quick-fix, the <code>@staticmethod</code> decorator is added:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class MyClass(object):
|
||||
@staticmethod
|
||||
def my_method(x):
|
||||
print(x)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+17
-1
@@ -1,5 +1,21 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects inconsistencies in overriding method signatures.
|
||||
<p>Reports inconsistencies in overriding method signatures.</p>
|
||||
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Book:
|
||||
def add_title(self):
|
||||
pass
|
||||
|
||||
|
||||
class Novel(Book):
|
||||
def add_title(self, text):
|
||||
pass
|
||||
</pre>
|
||||
|
||||
<p>Parameters of the <code>add_title</code> method in the <code>Novel</code> class do not match the method
|
||||
signature specified in the <code>Book</code> class. As a fix, the IDE offers to apply the Change Signature
|
||||
refactoring.</p>
|
||||
</body>
|
||||
</html>
|
||||
+26
-1
@@ -1,5 +1,30 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection looks for methods that lack a first parameter (which is usually named <code>self</code> ).
|
||||
<p>Reports methods that lack the first parameter that is usually
|
||||
named <code>self</code>.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Movie:
|
||||
|
||||
def show():
|
||||
pass
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class Movie:
|
||||
|
||||
def show(self):
|
||||
pass
|
||||
</pre>
|
||||
<p>The inspection also reports naming issues in class methods.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Movie:
|
||||
@classmethod
|
||||
def show(abc):
|
||||
pass
|
||||
</pre>
|
||||
<p>Since the first parameter of a class method should be <code>cls</code>, the IDE provides a quick-fix
|
||||
to rename it.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+25
-1
@@ -1,5 +1,29 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection warns if call to super constructor in class is missed
|
||||
<p>Reports cases when a call to the <code>super</code> constructor in a class is missed.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Fruit:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
class Pear(Fruit):
|
||||
def __init__(self):
|
||||
pass
|
||||
</pre>
|
||||
<p>The <code>Pear</code> class should have a <code>super</code> call in the <code>__init__</code>
|
||||
method.</p>
|
||||
<p>When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
class Fruit:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
class Pear(Fruit):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+23
-1
@@ -1,5 +1,27 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects lack of docstring and an empty docstring.
|
||||
<p>Reports missing and empty docstrings.</p>
|
||||
<p><b>Example of a missing docstring</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def demo(a):
|
||||
c = a ** 2
|
||||
</pre>
|
||||
<p><b>Example of an empty docstring</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def demo(a):
|
||||
"""
|
||||
"""
|
||||
c = a ** 2
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the code fragments change to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def demo(a):
|
||||
"""
|
||||
|
||||
:param a:
|
||||
"""
|
||||
c = a ** 2
|
||||
</pre>
|
||||
<p>You need to provide some details about the parameter in the generated template.</p>
|
||||
</body>
|
||||
</html>
|
||||
+4
-2
@@ -1,6 +1,8 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects lack of type hints for function declaration in
|
||||
one of the two formats: parameter annotations or a type comment
|
||||
<p>Reports missing type hints for function declaration in
|
||||
one of the two formats: parameter annotations or a type comment.</p>
|
||||
<p>Select the <b>Only when types are known</b> checkbox if you want the inspection check
|
||||
the types collected from runtime or inferred.</p>
|
||||
</body>
|
||||
</html>
|
||||
+22
-1
@@ -1,5 +1,26 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects invalid definition of namedtuple.
|
||||
<p>Reports invalid definition of a
|
||||
<a href="https://docs.python.org/3/library/typing.html#typing.NamedTuple">typing.NamedTuple</a>.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
import typing
|
||||
|
||||
|
||||
class FullName(typing.NamedTuple):
|
||||
first: str
|
||||
last: str = ""
|
||||
middle: str
|
||||
</pre>
|
||||
<p>As a fix, place the field with the default value after the fields without default values:</p>
|
||||
<pre style="font-family: monospace">
|
||||
import typing
|
||||
|
||||
|
||||
class FullName(typing.NamedTuple):
|
||||
first: str
|
||||
middle: str
|
||||
last: str = ""
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+20
-1
@@ -1,5 +1,24 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection looks for certain decorators that don't nest well.
|
||||
<p>Reports problems with nesting decorators. The inspection highlights the cases when <code>classmethod</code> or <code>staticmethod</code>
|
||||
is applied before another decorator.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def innocent(f):
|
||||
return f
|
||||
|
||||
|
||||
class A:
|
||||
@innocent # Decorator will not receive a callable it may expect
|
||||
@classmethod
|
||||
def f2(cls):
|
||||
pass
|
||||
|
||||
@innocent # Decorator will not receive a callable it may expect
|
||||
@staticmethod
|
||||
def f1():
|
||||
pass
|
||||
</pre>
|
||||
<p>As a quick-fix, the IDE offers to remove the decorator.</p>
|
||||
</body>
|
||||
</html>
|
||||
+18
-1
@@ -1,5 +1,22 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects file contains non-ASCII characters and doesn't have an encoding declaration at the top.
|
||||
<p>Reports cases in Python 2 when a file contains non-ASCII characters and does not
|
||||
have an encoding declaration at the top.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class A(object):
|
||||
# №5
|
||||
def __init__(self):
|
||||
pass
|
||||
</pre>
|
||||
<p>In this example, the IDE reports a non-ASCII symbol in a comment and a lack of encoding
|
||||
declaration. Apply the proposed quick-fix to add a missing encoding declaration:</p>
|
||||
<pre style="font-family: monospace">
|
||||
# coding=utf-8
|
||||
class A(object)
|
||||
# №5
|
||||
def __init__(self):
|
||||
pass
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+12
-2
@@ -1,6 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection is similar to pylint inspection E1111. It highlights situations when an assignment is done on a function call but the
|
||||
inferred function doesn't return anything.
|
||||
<p>Reports cases when an assignment is done on a function that does not return anything.</p>
|
||||
This inspection is similar to <a href="https://docs.pylint.org/en/1.6.0/features.html#id6">pylint inspection E1111</a>.
|
||||
<p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def just_print():
|
||||
print("Hello!")
|
||||
|
||||
|
||||
action = just_print()
|
||||
</pre>
|
||||
<p>As a quick-fix, the IDE offers to remove the assignment.</p>
|
||||
</body>
|
||||
</html>
|
||||
+5
-1
@@ -1,5 +1,9 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights occurrences of new-style class features in old-style classes.
|
||||
<p>Reports occurrences of
|
||||
<a href="https://www.python.org/doc/newstyle/">new-style class features</a>
|
||||
in old-style classes. The inspection highlights
|
||||
<code>__slots__</code>, <code>__getattribute__</code>, and <code>super()</code>
|
||||
inside old-style classes.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,24 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection validates overloads in regular Python files.
|
||||
<p>Reports cases when overloads in regular Python files are placed after the implementation or when their signatures are
|
||||
not compatible with the implementation.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
from typing import overload
|
||||
|
||||
|
||||
@overload
|
||||
def foo(p1, p2): # Overload signature is not compatible with the implementation
|
||||
pass
|
||||
|
||||
|
||||
@overload
|
||||
def foo(p1): # Overload signature is not compatible with the implementation
|
||||
pass
|
||||
|
||||
|
||||
def foo(p1, p2, p3):
|
||||
print(p1, p2, p3)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+6
-1
@@ -1,5 +1,10 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection warns about imported or required, but not installed packages.
|
||||
<p>
|
||||
Reports packages mentioned in requirements files (for example, <code>requirements.txt</code> or <code>Pipfile</code>) but not installed,
|
||||
or imported but not mentioned in requirements files.</p>
|
||||
<p>
|
||||
The IDE shows a quick-fix banner so that you can install the missing packages in one click.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
+22
-2
@@ -1,6 +1,26 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection checks that properties are accessed correctly:
|
||||
read-only not set, write-only not read, non-deletable not deleted.
|
||||
Reports cases when properties are accessed inappropriately:
|
||||
<ul>
|
||||
<li>Read-only properties are set</li>
|
||||
<li>Write-only properties are read</li>
|
||||
<li>Non-deletable properties are deleted</li>
|
||||
</ul>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
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
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+21
-2
@@ -1,6 +1,25 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection checks that arguments to <code>property()</code> and functions annotated with
|
||||
<code>@property</code> and friends look reasonably.
|
||||
<p>Reports problems with the arguments of <code>property()</code> and functions
|
||||
annotated with <code>@property</code>.</p>
|
||||
<pre style="font-family: monospace">
|
||||
class C:
|
||||
@property
|
||||
def abc(self): # Getter should return or yield something
|
||||
pass
|
||||
|
||||
@abc.setter
|
||||
def foo(self, value): # Names of function and decorator don't match
|
||||
pass
|
||||
|
||||
@abc.setter
|
||||
def abc(self, v1, v2): # Setter signature should be (self, value)
|
||||
pass
|
||||
|
||||
@abc.deleter
|
||||
def abc(self, v1): # Delete signature should be (self)
|
||||
pass
|
||||
</pre>
|
||||
<p>A quick-fix offers to update parameters.</p>
|
||||
</body>
|
||||
</html>
|
||||
+16
-1
@@ -1,5 +1,20 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection warns if a protected member is accessed outside the class, a descendant of the class where it's defined or a module.
|
||||
<p>Reports cases when a protected member is accessed outside the class,
|
||||
a descendant of the class where it is defined, or a module.</p>
|
||||
<pre style="font-family: monospace">
|
||||
class Foo:
|
||||
def _protected_method(self):
|
||||
pass
|
||||
|
||||
|
||||
class Bar(Foo):
|
||||
def public_method(self):
|
||||
self._protected_method()
|
||||
|
||||
|
||||
foo = Foo()
|
||||
foo._protected_method() # Access to a protected method
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,25 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects invalid definitions and usages of protocols introduced in PEP-544.
|
||||
<p>Reports invalid definitions and usages of protocols introduced in
|
||||
<a href="https://www.python.org/dev/peps/pep-0544/">PEP-544</a>.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
from typing import Protocol
|
||||
|
||||
|
||||
class MyProtocol(Protocol):
|
||||
def method(self, p: int) -> str:
|
||||
pass
|
||||
|
||||
|
||||
class MyClass(MyProtocol):
|
||||
def method(self, p: str) -> int: # Type of 'method' is not compatible with 'MyProtocol'
|
||||
pass
|
||||
|
||||
|
||||
class MyAnotherProtocol(MyClass, Protocol): # All bases of a protocol must be protocols
|
||||
pass
|
||||
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+9
-3
@@ -1,9 +1,15 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects unconditional redeclarations of names without being used in between, like this: <br/>
|
||||
<pre>def x(): pass
|
||||
<p>Reports unconditional redeclarations of names without being used in between.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def x(): pass
|
||||
|
||||
|
||||
x = 2
|
||||
</pre>
|
||||
It applies to function and class declarations, and top-level assignments. <br/>
|
||||
<p>It applies to function and class declarations, and top-level assignments. </p>
|
||||
<p>When the warning is shown, you can try a recommended action, for example, you might be prompted to
|
||||
rename the variable.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights redundant parentheses in statements.
|
||||
<p>Reports about redundant parentheses in expressions.</p>
|
||||
<p>The IDE provides the quick-fix action to remove the redundant parentheses.</p>
|
||||
</body>
|
||||
</html>
|
||||
+16
-2
@@ -1,6 +1,20 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports occurrences of <code>return</code> statements with a return value inside
|
||||
<code>__init__</code> methods of classes. A constructor should not return any value.
|
||||
<p>
|
||||
Reports occurrences of <code>return</code> statements with a return value inside
|
||||
<code>__init__</code> methods of classes.
|
||||
</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Sum:
|
||||
def __init__(self, a, b):
|
||||
self.a = a
|
||||
self.b = b
|
||||
self.sum = a + b
|
||||
return self.sum
|
||||
</pre>
|
||||
<p>A constructor should not return any value. The <code>__init__</code> method should
|
||||
only initialize the values of instance members for news objects.</p>
|
||||
<p>As a quick-fix, the IDE offers to remove the <code>return</code> statement.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+14
-2
@@ -1,6 +1,18 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects call for function "set" which can be replaced with
|
||||
set literal.
|
||||
<p>Reports calls to the <code>set</code> function that can be replaced with
|
||||
the <code>set</code> literal.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def do_mult(a, b):
|
||||
c = a * b
|
||||
return set([c, a, b])
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def do_mult(a, b):
|
||||
c = a * b
|
||||
return {c, a, b}
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+8
-1
@@ -1,5 +1,12 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects shadowing names defined in outer scopes.
|
||||
<p>Reports shadowing names defined in outer scopes.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def outer(p):
|
||||
def inner(p):
|
||||
pass
|
||||
</pre>
|
||||
<p>As a quick-fix, the IDE offers to remove a parameter or rename it.</p>
|
||||
</body>
|
||||
</html>
|
||||
+13
-1
@@ -1,5 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects equality comparison with a boolean literal.
|
||||
<p>Reports equality comparison with a boolean literal.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def func(s):
|
||||
if s.isdigit() == True:
|
||||
return int(s)
|
||||
</pre>
|
||||
<p>With the quick-fix applied, the code fragment will be simplified to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def func(s):
|
||||
if s.isdigit():
|
||||
return int(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+13
-1
@@ -1,5 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights docstrings not using triple double-quoted string format.
|
||||
<p>Reports docstrings that do not adhere to the triple double-quoted string format.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def calc(self, balance=0):
|
||||
'param: balance'
|
||||
self.balance = balance
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def calc(self, balance=0):
|
||||
"""param: balance"""
|
||||
self.balance = balance
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+12
-1
@@ -1,5 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects statements without any effect.
|
||||
<p>Reports statements that have no effect.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Car:
|
||||
def __init__(self, speed=0):
|
||||
self.speed = speed
|
||||
self.time # has no effect
|
||||
|
||||
2 + 3 # has no effect
|
||||
</pre>
|
||||
<p>In this example, you can either add a field <code>time</code> to the <code>Car</code> class or
|
||||
introduce variables for the problematic statements.</p>
|
||||
</body>
|
||||
</html>
|
||||
+15
-1
@@ -1,5 +1,19 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects errors in string formatting operations.
|
||||
<p>Reports errors in string formatting operations.</p>
|
||||
<p><b>Example 1:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
"Hello {1}".format("people")
|
||||
</pre>
|
||||
<p><b>Example 2:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def bar():
|
||||
return 1
|
||||
|
||||
|
||||
"%s %s" % bar()
|
||||
</pre>
|
||||
<p>As a fix, you need to rewrite string formatting fragments to
|
||||
adhere to the <a href="https://docs.python.org/3/library/string.html#format-string-syntax">formatting syntax</a>.</p>
|
||||
</body>
|
||||
</html>
|
||||
+23
-1
@@ -1,5 +1,27 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection check that in any call to super(A, B), B either is an instance of A or a subclass of A.
|
||||
<p>Reports cases when any call to <code>super(A, B)</code> does not meet the
|
||||
following requirements:</p>
|
||||
<ul>
|
||||
<li><code>B</code> is an instance of <code>A</code></li>
|
||||
<li><code>B</code> a subclass of <code>A</code></li>
|
||||
</ul>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
class Figure:
|
||||
def color(self):
|
||||
pass
|
||||
|
||||
|
||||
class Rectangle(Figure):
|
||||
def color(self):
|
||||
pass
|
||||
|
||||
|
||||
class Square(Figure):
|
||||
def color(self):
|
||||
return super(Rectangle, self).color() # Square is not an instance or subclass of Rectangle
|
||||
</pre>
|
||||
<p>As a fix, you can make the <code>Square</code> an instance of the <code>Rectangle</code> class.</p>
|
||||
</body>
|
||||
</html>
|
||||
+14
-1
@@ -1,5 +1,18 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects trailing semicolons in statements.
|
||||
<p>Reports trailing semicolons in statements.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def my_func(a):
|
||||
c = a ** 2;
|
||||
return c
|
||||
</pre>
|
||||
<p>IDE provides a quick-fix that removes a trailing semicolon. When you
|
||||
apply it, the code changes to:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def my_func(a):
|
||||
c = a ** 2
|
||||
return c
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+9
-1
@@ -1,5 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection check that the number of expressions on right-hand side and targets on left-hand side are the same.
|
||||
<p>Reports cases when the number of expressions on the right-hand side
|
||||
and targets on the left-hand side are not the same.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
t = ('red', 'blue', 'green', 'white')
|
||||
(c1, c2, c3) = t
|
||||
</pre>
|
||||
<p>As a quick-fix, you can modify the highlighted code fragment to restore the tuple
|
||||
balance.</p>
|
||||
</body>
|
||||
</html>
|
||||
+6
-1
@@ -1,5 +1,10 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects assignments to tuple item.
|
||||
<p>Reports assignments to a tuple item.</p>
|
||||
<pre style="font-family: monospace">
|
||||
t = ('red', 'blue', 'green', 'white')
|
||||
t[3] = 'black'
|
||||
</pre>
|
||||
<p>A quick-fix offers to replace the tuple with a list.</p>
|
||||
</body>
|
||||
</html>
|
||||
+21
-4
@@ -1,8 +1,25 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects type errors in function call expressions.
|
||||
Due to dynamic dispatch and duck typing, this is possible in a limited but
|
||||
useful number of cases. Types of function parameters can be specified in
|
||||
docstrings or in Python 3 function annotations.
|
||||
<p>Reports type errors in function call expressions, targets, and return values. In a dynamically typed language, this is possible in a limited number of cases. </p>
|
||||
<p>Types of function parameters can be specified in
|
||||
docstrings or in Python 3 function annotations.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
def foo() -> int:
|
||||
return "abc" # Expected int, got str
|
||||
|
||||
|
||||
a: str
|
||||
a = foo() # Expected str, got int
|
||||
</pre>
|
||||
<p>With the quick-fix, you can modify the problematic types:</p>
|
||||
<pre style="font-family: monospace">
|
||||
def foo() -> str:
|
||||
return "abc"
|
||||
|
||||
|
||||
a: str
|
||||
a = foo()
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects invalid usages of type hints.
|
||||
<p>Reports invalid usages of type hints.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
from typing import TypeVar
|
||||
|
||||
T0 = TypeVar('T1') # Argument of 'TypeVar' must be 'T0'
|
||||
|
||||
|
||||
def b(p: int) -> int: # Type specified both in a comment and annotation
|
||||
# type: (int) -> int
|
||||
pass
|
||||
|
||||
|
||||
def c(p1, p2): # Type signature has too many arguments
|
||||
# type: (int) -> int
|
||||
pass
|
||||
</pre>
|
||||
<p>Available quick-fixes offer various actions. You can rename, remove, or move problematic elements. You can also manually modify type declarations to ensure no warning is shown.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,25 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects invalid definition and usage of TypedDict.
|
||||
<p>Reports invalid definition and usage of
|
||||
<a href="https://www.python.org/dev/peps/pep-0589/">TypedDict</a>.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
from typing import TypedDict
|
||||
|
||||
|
||||
class Movie(TypedDict):
|
||||
name: str
|
||||
year: int
|
||||
rate: int = 10 # Right-hand side values are not supported
|
||||
|
||||
def method(self): # Invalid statement in TypedDict
|
||||
pass
|
||||
|
||||
|
||||
m = Movie(name="name", year=1000, rate=9)
|
||||
print(m["director"]) # There is no the 'director' key in 'Movie'
|
||||
del m["name"] # The 'name' key cannot be deleted
|
||||
m["year"] = "1001" # Expected 'int', got 'str'
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+15
-1
@@ -1,5 +1,19 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection warns about local variables referenced before assignment.
|
||||
<p>Reports local variables referenced before assignment.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
x = 0
|
||||
if x > 10:
|
||||
b = 3
|
||||
print(b)
|
||||
</pre>
|
||||
<p>The IDE reports a problem for <code>print(b)</code>. A possible fix is:</p>
|
||||
<pre style="font-family: monospace">
|
||||
x = 0
|
||||
if x > 10:
|
||||
b = 3
|
||||
print(b)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
+8
-1
@@ -1,5 +1,12 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights backslashes in places where line continuation is implicit (inside (), [], {}).
|
||||
<p>Reports backslashes in places where line continuation is implicit inside <code>()</code>,
|
||||
<code>[]</code>, and <code>{}</code>.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
a = ('first', \
|
||||
'second', 'third')
|
||||
</pre>
|
||||
<p>When the quick-fix is applied, the redundant backslash is deleted.</p>
|
||||
</body>
|
||||
</html>
|
||||
+10
-1
@@ -1,4 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects code which can not be normally reached.
|
||||
<p>Reports code fragments that cannot be normally reached.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre style="font-family: monospace">
|
||||
if True:
|
||||
print('Yes')
|
||||
else:
|
||||
print('No')
|
||||
</pre>
|
||||
<p>As a fix, you might want to check and modify the algorithm to ensure it implements
|
||||
the expected logic.</p>
|
||||
</body></html>
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection highlights local variables,parameters or local functions unused in scope.
|
||||
<p>
|
||||
Reports local variables, parameters, and functions that are locally defined, but not used name in a function.
|
||||
</p>
|
||||
</body></html>
|
||||
|
||||
@@ -458,7 +458,7 @@ INSP.GROUP.python=Python
|
||||
|
||||
INSP.abstract.class.set.as.metaclass=Set ''{0}'' as metaclass
|
||||
INSP.abstract.class.add.to.superclasses=Add ''{0}'' to superclasses
|
||||
INSP.named.tuple=Namedtuple definition
|
||||
INSP.named.tuple=Invalid definition of 'typing.NamedTuple'
|
||||
INSP.shadows.name.from.outer.scope=Shadows name ''{0}'' from outer scope
|
||||
INSP.trailing.semicolon=Trailing semicolon in the statement
|
||||
INSP.protected.member.ignore.annotations=Ignore annotations
|
||||
@@ -493,11 +493,11 @@ INSP.stub.packages.compatibility.incompatible.packages.message=''{0}{1}{2}'' is
|
||||
INSP.arguments.not.declared.but.provided.by.decorator=Following arguments are not declared but provided by decorator: {0}
|
||||
INSP.pep8.coding.style.violation=PEP 8 coding style violation
|
||||
INSP.shadowing.names=Shadowing names from outer scopes
|
||||
INSP.stub.packages.compatibility=Stub packages compatibility inspection
|
||||
INSP.stub.packages.compatibility=Incompatible stub packages
|
||||
INSP.stub.packages=Stub packages advertiser
|
||||
|
||||
# PyCallingNonCallableInspection
|
||||
INSP.NAME.calling.non.callable=Trying to call a non-callable object
|
||||
INSP.NAME.calling.non.callable=Attempt to call a non-callable object
|
||||
INSP.class.object.is.not.callable=''{0}'' object is not callable
|
||||
INSP.symbol.is.not.callable=''{0}'' is not callable
|
||||
INSP.expression.is.not.callable=Expression is not callable
|
||||
@@ -514,7 +514,7 @@ INSP.expected.dict.got.type=Expected a dictionary, got {0}
|
||||
INSP.expected.iterable.got.type=Expected an iterable, got {0}
|
||||
|
||||
# PyMethodParametersInspection
|
||||
INSP.NAME.problematic.first.parameter=Methods having troubles with first parameter
|
||||
INSP.NAME.problematic.first.parameter=Improper first parameter
|
||||
INSP.must.have.first.parameter=Method must have a first parameter, usually called ''{0}''
|
||||
INSP.probably.mistyped.self=Did not you mean 'self'?
|
||||
INSP.usually.named.self=Usually first parameter of a method is named 'self'
|
||||
@@ -526,7 +526,7 @@ INSP.NAME.nested.decorators=Problematic nesting of decorators
|
||||
INSP.decorator.receives.unexpected.builtin=This decorator will not receive a callable it may expect; the built-in decorator returns a special object
|
||||
|
||||
# PyRedeclarationInspection
|
||||
INSP.NAME.redeclaration=Redeclared names without usage
|
||||
INSP.NAME.redeclaration=Redeclared names without usages
|
||||
INSP.redeclared.name=Redeclared ''{0}'' defined above without usage
|
||||
|
||||
# PyUnresolvedReferencesInspection
|
||||
@@ -534,7 +534,7 @@ INSP.try.except.import.error=''{0}'' in the try block with ''except ImportError'
|
||||
INSP.unused.import.statement=Unused import statement <code>#ref</code>
|
||||
|
||||
# PyInterpreterInspection
|
||||
INSP.NAME.invalid.interpreter=Invalid interpreter configured
|
||||
INSP.NAME.invalid.interpreter=An invalid interpreter
|
||||
INSP.interpreter.pipenv.interpreter.associated.with.another.project=Pipenv interpreter is associated with another project: ''{0}''
|
||||
INSP.interpreter.pipenv.interpreter.associated.with.another.module=Pipenv interpreter is associated with another module: ''{0}''
|
||||
INSP.interpreter.pipenv.interpreter.not.associated.with.any.project=Pipenv interpreter is not associated with any project
|
||||
@@ -581,18 +581,18 @@ INSP.new.incompatible.to.init=Signature is not compatible to __init__
|
||||
INSP.init.incompatible.to.new=Signature is not compatible to __new__
|
||||
|
||||
# PyTrailingSemicolonInspection
|
||||
INSP.NAME.trailing.semicolon=Trailing semicolon in statement
|
||||
INSP.NAME.trailing.semicolon=Prohibited trailing semicolon in a statement
|
||||
|
||||
|
||||
# PyUnboundLocalVariableInspection
|
||||
INSP.NAME.unbound=Unbound local variable
|
||||
INSP.NAME.unbound=Unbound local variables
|
||||
INSP.unbound.local.variable=Local variable ''{0}'' might be referenced before assignment
|
||||
INSP.unbound.nonlocal.variable=Nonlocal variable ''{0}'' must be bound in an outer function scope
|
||||
INSP.unbound.name.undefined=Name ''{0}'' can be undefined
|
||||
INSP.unbound.function.too.large=Function ''{0}'' is too large to analyse
|
||||
|
||||
# PyListCreationInspection
|
||||
INSP.NAME.list.creation=List creation could be rewritten by list literal
|
||||
INSP.NAME.list.creation=Non-optimal list declaration
|
||||
INSP.list.creation.this.list.creation.could.be.rewritten.as.list.literal=This list creation could be rewritten as a list literal
|
||||
|
||||
# PyTupleAssignmentBalanceInspection
|
||||
@@ -608,15 +608,15 @@ INSP.classic.class.usage.old.style.class.ancestors=Old-style class, because all
|
||||
|
||||
|
||||
# PyExceptionInheritance
|
||||
INSP.NAME.exception.not.inherit=Exception doesn't inherit from standard ''Exception'' class
|
||||
INSP.NAME.exception.not.inherit=Exceptions do not inherit from standard 'Exception' class
|
||||
INSP.exception.inheritance.exception.does.not.inherit.from.base.exception.class=Exception doesn't inherit from base 'Exception' class
|
||||
|
||||
# PyDefaultArgumentInspection
|
||||
INSP.NAME.default.argument=Default argument is mutable
|
||||
INSP.NAME.default.argument=The default argument is mutable
|
||||
INSP.default.arguments.default.argument.value.mutable=Default argument value is mutable
|
||||
|
||||
# PyDocstringTypesInspection
|
||||
INSP.NAME.docstring.types=Type in docstring doesn't match inferred type
|
||||
INSP.NAME.docstring.types=Type in docstring does not match inferred type
|
||||
INSP.docstring.types.dynamically.inferred.type.does.not.match.specified.type=Dynamically inferred type ''{0}'' doesn''t match specified type ''{1}''
|
||||
|
||||
# PyStatementEffectInspection
|
||||
@@ -640,17 +640,17 @@ INSP.mandatory.encoding.checkbox.enable.in.python.3=Enable in Python 3+
|
||||
INSP.mandatory.encoding.no.encoding.specified.for.file=No encoding specified for file
|
||||
|
||||
# PyTupleItemAssignmentInspection
|
||||
INSP.NAME.tuple.item.assignment=Tuple item assignment
|
||||
INSP.NAME.tuple.item.assignment=Tuple item assignment is prohibited
|
||||
INSP.tuples.never.assign.items=Tuples don't support item assignment
|
||||
|
||||
# PyPropertyAccessInspection
|
||||
INSP.NAME.property.access=Access to properties
|
||||
INSP.NAME.property.access=Inappropriate access to properties
|
||||
INSP.property.cannot.be.set=Property ''{0}'' cannot be set
|
||||
INSP.property.cannot.be.read=Property ''{0}'' cannot be read
|
||||
INSP.property.cannot.be.deleted=Property ''{0}'' cannot be deleted
|
||||
|
||||
# PyPropertyDefinitionInspection
|
||||
INSP.NAME.property.definition=Property definitions
|
||||
INSP.NAME.property.definition=Incorrect property definition
|
||||
INSP.doc.param.should.be.str=The doc parameter should be a string
|
||||
INSP.strange.arg.want.callable=Strange argument; a callable is expected
|
||||
INSP.func.property.name.mismatch=Names of function and decorator don't match; property accessor is not created
|
||||
@@ -662,7 +662,7 @@ INSP.setter.signature.advice=Setter signature should be (self, value)
|
||||
INSP.deleter.signature.advice=Deleter signature should be (self)
|
||||
|
||||
# PyProtectedMemberInspection
|
||||
INSP.NAME.protected.member=Access to a protected member of a class or a module
|
||||
INSP.NAME.protected.member=Accessing a protected member of a class or a module
|
||||
INSP.protected.member.access.to.protected.member.of.class=Access to a protected member {0} of a class
|
||||
INSP.protected.member.access.to.protected.member.of.module=Access to a protected member {0} of a module
|
||||
INSP.protected.member.name.not.declared.in.all=''{0}'' is not declared in __all__
|
||||
@@ -674,7 +674,7 @@ INSP.oldstyle.class.getattribute=Old-style class contains __getattribute__ defin
|
||||
INSP.oldstyle.class.super=Old-style class contains call for super method
|
||||
|
||||
# PyCompatibilityInspection
|
||||
INSP.NAME.compatibility=Code compatibility inspection
|
||||
INSP.NAME.compatibility=Code is incompatible with specific Python versions
|
||||
INSP.compatibility.this.syntax.available.only.since.py3=This syntax available only since Python 3
|
||||
INSP.compatibility.check.for.compatibility.with.python.versions=Check for compatibility with python versions:
|
||||
INSP.compatibility.inspection.unsupported.feature.prefix=Python {0,choice,1#version|2#versions} {1} {0,choice,1#does|2#do} not {2}
|
||||
@@ -736,18 +736,18 @@ INSP.NAME.single.quoted.docstring=Single quoted docstring
|
||||
INSP.message.single.quoted.docstring=Triple double-quoted strings should be used for docstrings.
|
||||
|
||||
# PyMissingConstructorInspection
|
||||
INSP.NAME.missing.super.constructor=Missed call to __init__ of super class
|
||||
INSP.NAME.missing.super.constructor=Missed call to '__init__' of the super class
|
||||
INSP.missing.super.constructor.message=Call to __init__ of super class is missed
|
||||
|
||||
# PySetFunctionToLiteralInspection
|
||||
INSP.NAME.set.function.to.literal=Function call can be replaced with set literal
|
||||
|
||||
# PyDecoratorInspection
|
||||
INSP.NAME.decorator.outside.class=Class specific decorator on method outside class
|
||||
INSP.NAME.decorator.outside.class=Class-specific decorator is used outside the class
|
||||
INSP.decorators.method.only.decorator.on.method.outside.class=Decorator {0} on a method outside the class
|
||||
|
||||
# PyPackageRequirementsInspection
|
||||
INSP.NAME.requirements=Package requirements
|
||||
INSP.NAME.requirements=Unsatisfied package requirements
|
||||
INSP.requirements.column.name.ignore.packages=Ignore Packages
|
||||
INSP.requirements.ignore.packages.label=Ignored packages:
|
||||
INSP.requirements.package.requirements.not.satisfied=Package {1,choice,1#requirement|2#requirements} {0} {1,choice,1#is|2#are} not satisfied
|
||||
@@ -756,18 +756,18 @@ QFIX.NAME.install.requirements=Install {0,choice,1#requirement|2#requirements}
|
||||
QFIX.NAME.ignore.requirements=Ignore {0,choice,1#requirement|2#requirements}
|
||||
|
||||
# PyClassHasNoInitInspection
|
||||
INSP.NAME.class.has.no.init=Class has no __init__ method
|
||||
INSP.NAME.class.has.no.init=Class has no `__init__` method
|
||||
INSP.class.has.no.init=Class has no __init__ method
|
||||
|
||||
#PyNoneFunctionAssignmentInspection
|
||||
INSP.NAME.none.function.assignment=Assigning function call that doesn't return anything
|
||||
INSP.NAME.none.function.assignment=Assigning function calls that don't return anything
|
||||
INSP.none.function.assignment=Function ''{0}'' doesn''t return anything
|
||||
|
||||
# PyTestParametrizedInspection
|
||||
INSP.NAME.pytest-parametrized=Checks that functions decorated by pytest parametrize have correct arguments
|
||||
INSP.NAME.pytest-parametrized=Incorrect arguments in @pytest.mark.parametrize
|
||||
|
||||
# PyUnusedLocalInspection
|
||||
INSP.NAME.unused=Unused local
|
||||
INSP.NAME.unused=Unused local symbols
|
||||
INSP.unused.locals.parameter.isnot.used=Parameter ''{0}'' value is not used
|
||||
INSP.unused.locals.local.variable.isnot.used=Local variable ''{0}'' value is not used
|
||||
INSP.unused.locals.replace.with.wildcard=Replace with _
|
||||
@@ -780,7 +780,7 @@ INSP.unused.locals.ignore.lambda.parameters=Ignore lambda parameters
|
||||
INSP.unused.locals.ignore.variables.used.in.tuple.unpacking=Ignore variables used in tuple unpacking
|
||||
|
||||
# PyChainedComparsonsInspection
|
||||
INSP.NAME.chained.comparisons=Chained comparisons can be simplified
|
||||
INSP.NAME.chained.comparisons=Too complex chained comparisons
|
||||
INSP.chained.comparisons.ignore.statements.with.constant.in.the.middle=Ignore statements with a constant in the middle
|
||||
INSP.simplify.chained.comparison=Simplify chained comparison
|
||||
|
||||
@@ -789,19 +789,19 @@ INSP.NAME.augment.assignment=Assignment can be replaced with augmented assignmen
|
||||
INSP.assignment.can.be.replaced.with.augmented.assignment=Assignment can be replaced with an augmented assignment
|
||||
|
||||
# PyBroadExceptionInspection
|
||||
INSP.NAME.too.broad.exception.clauses=Too broad exception clauses
|
||||
INSP.NAME.too.broad.exception.clauses=Unclear exception clauses
|
||||
INSP.too.broad.exception.clause=Too broad exception clause
|
||||
|
||||
# PyByteLiteralInspection
|
||||
INSP.NAME.byte.literal=Byte literal contains characters > 255
|
||||
INSP.NAME.byte.literal=A byte literal contains a non-ASCII character
|
||||
INSP.byte.literal.contains.illegal.characters=Byte literal contains characters > 255
|
||||
|
||||
# PyComparisonWithNoneInspection
|
||||
INSP.NAME.comparison.with.none=Comparison with None performed with equality operators
|
||||
INSP.NAME.comparison.with.none=Using equality operators to compare with None
|
||||
INSP.comparison.with.none.performed.with.equality.operators=Comparison with None performed with equality operators
|
||||
|
||||
# PyDictCreationInspection
|
||||
INSP.NAME.dict.creation=Dictionary creation could be rewritten by dictionary literal
|
||||
INSP.NAME.dict.creation=Dictionary creation can be rewritten by dictionary literal
|
||||
INSP.dict.creation.this.dictionary.creation.could.be.rewritten.as.dictionary.literal=This dictionary creation could be rewritten as a dictionary literal
|
||||
|
||||
# PyDictDuplicateKeysInspection
|
||||
@@ -809,15 +809,15 @@ INSP.NAME.duplicate.keys=Dictionary contains duplicate keys
|
||||
INSP.duplicate.keys.dictionary.contains.duplicate.keys=Dictionary contains duplicate keys ''{0}''
|
||||
|
||||
# PyFromFutureImportInspection
|
||||
INSP.NAME.from.future.import=from __future__ import must be the first executable statement
|
||||
INSP.NAME.from.future.import=Improper position of from __future__ import
|
||||
INSP.from.future.import.from.future.imports.must.occur.at.beginning.file=from __future__ imports must occur at the beginning of the file
|
||||
|
||||
# PyMethodFirstArgAssignmentInspection
|
||||
INSP.NAME.first.arg.assign=Reassignment of method's first argument
|
||||
INSP.NAME.first.arg.assign=First argument of the method is reassigned
|
||||
INSP.first.arg.assign.method.parameter.reassigned=Method''s parameter ''{0}'' reassigned
|
||||
|
||||
# PyMethodMayBeStaticInspection
|
||||
INSP.NAME.method.may.be.static=Method may be static
|
||||
INSP.NAME.method.may.be.static=Method is not declared static
|
||||
INSP.method.may.be.static=Method <code>#ref</code> may be 'static'
|
||||
|
||||
# PyAbstractClassInspection
|
||||
@@ -825,19 +825,19 @@ INSP.NAME.abstract.class=Class must implement all abstract methods
|
||||
INSP.abstract.class.class.must.implement.all.abstract.methods=Class {0} must implement all abstract methods
|
||||
|
||||
#PyAssignmentToLoopOrWithParameterInspection
|
||||
INSP.NAME.assignment.to.loop.or.with.parameter=Assignment to 'for' loop or 'with' statement parameter
|
||||
INSP.NAME.assignment.to.loop.or.with.parameter=Assignments to 'for' loop or 'with' statement parameter
|
||||
INSP.assignment.to.loop.or.with.parameter=Variable ''{0}'' is already declared in ''for'' loop or ''with'' statement above
|
||||
|
||||
# PyArgumentEqualDefaultInspection
|
||||
INSP.NAME.argument.equal.default=Argument passed to function is equal to default parameter value
|
||||
INSP.NAME.argument.equal.default=The function argument is equal to the default parameter value
|
||||
INSP.argument.equals.to.default=Argument equals to the default parameter value
|
||||
|
||||
#PyAsyncCallInspection
|
||||
INSP.NAME.coroutine.is.not.awaited=Coroutine ''{0}'' is not awaited
|
||||
INSP.async.call=Coroutine is not awaited
|
||||
INSP.async.call=Missing `await` syntax in coroutine calls
|
||||
|
||||
# PyAttributeOutsideInitInspection
|
||||
INSP.NAME.attribute.outside.init=Instance attribute defined outside __init__
|
||||
INSP.NAME.attribute.outside.init=An instance attribute is defined outside `__init__`
|
||||
INSP.attribute.outside.init=Instance attribute {0} defined outside __init__
|
||||
|
||||
# PyMissingOrEmptyDocstringInspection
|
||||
@@ -868,7 +868,7 @@ INSP.redundant.parens.ignore.tuples=Ignore tuples
|
||||
INSP.redundant.parens.ignore.argument.of.operator=Ignore argument of % operator
|
||||
|
||||
# PySimplifyBooleanCheckInspection
|
||||
INSP.NAME.check.can.be.simplified=Boolean variable check can be simplified
|
||||
INSP.NAME.check.can.be.simplified=Redundant boolean variable check
|
||||
INSP.expression.can.be.simplified=Expression can be simplified
|
||||
INSP.simplify.boolean.check.ignore.comparison.to.zero=Ignore comparison to zero
|
||||
|
||||
@@ -878,16 +878,16 @@ INSP.missing.parameter.in.docstring=Missing parameter {0} in docstring
|
||||
INSP.unexpected.parameter.in.docstring=Unexpected parameter {0} in docstring
|
||||
|
||||
# PyExceptClausesOrderInspection
|
||||
INSP.NAME.bad.except.clauses.order=Bad except clauses order
|
||||
INSP.NAME.bad.except.clauses.order=Wrong order of 'except' clauses
|
||||
INSP.bad.except.exception.class.already.caught=Exception class ''{0}'' has already been caught
|
||||
INSP.bad.except.superclass.of.exception.class.already.caught=''{0}'', superclass of the exception class ''{1}'', has already been caught
|
||||
|
||||
#PyGlobalUndefinedInspection
|
||||
INSP.NAME.global.undefined=Global variable is undefined at the module level
|
||||
INSP.NAME.global.undefined=Global variable is not defined at the module level
|
||||
INSP.global.variable.undefined=Global variable ''{0}'' is undefined at the module level
|
||||
|
||||
#PyDataclassInspection
|
||||
INSP.NAME.dataclass.definition.and.usages=Dataclass definition and usages
|
||||
INSP.NAME.dataclass.definition.and.usages=Invalid definition and usage of Data Classes
|
||||
INSP.dataclasses.operator.not.supported.between.instances.of.class=''{0}'' not supported between instances of ''{1}''
|
||||
INSP.dataclasses.operator.not.supported.between.instances.of.classes=''{0}'' not supported between instances of ''{1}'' and ''{2}''
|
||||
INSP.dataclasses.object.could.have.no.attribute.because.it.declared.as.init.only=''{0}'' object could have no attribute ''{1}'' because it is declared as init-only
|
||||
@@ -927,12 +927,12 @@ INSP.NAME.deprecated.function.class.or.module=Deprecated function, class, or mod
|
||||
INSP.deprecation.abc.decorator.deprecated.use.alternative=''{0}'' is deprecated since Python 3.3. Use ''{1}'' with ''{2}'' instead
|
||||
|
||||
# PyDunderSlotsInspection
|
||||
INSP.NAME.dunder.slots=Definition of __slots__ in a class
|
||||
INSP.NAME.dunder.slots=Invalid usages of classes with '__slots__' definitions
|
||||
INSP.dunder.slots.name.in.slots.conflicts.with.class.variable=''{0}'' in __slots__ conflicts with a class variable
|
||||
INSP.dunder.slots.class.object.attribute.read.only=''{0}'' object attribute ''{1}'' is read-only
|
||||
|
||||
# PyFinalInspection
|
||||
INSP.NAME.final.classes.methods.and.variables=Final classes, methods, and variables
|
||||
INSP.NAME.final.classes.methods.and.variables=Invalid usages of final classes, methods, and variables
|
||||
INSP.final.super.classes.are.marked.as.final.and.should.not.be.subclassed={0} {1,choice,1#is|2#are} marked as ''@final'' and should not be subclassed
|
||||
INSP.final.final.should.be.placed.on.first.overload='@final' should be placed on the first overload
|
||||
INSP.final.method.marked.as.final.should.not.be.overridden=''{0}'' is marked as ''@final'' and should not be overridden
|
||||
@@ -988,14 +988,14 @@ INSP.pep8.naming.camelcase.variable.imported.as.lowercase=CamelCase variable imp
|
||||
INSP.pep8.naming.camelcase.variable.imported.as.constant=CamelCase variable imported as constant
|
||||
|
||||
# PyProtocolInspection
|
||||
INSP.NAME.protocol.definition.and.usages=Protocol definition and usages
|
||||
INSP.NAME.protocol.definition.and.usages=Invalid protocol definitions and usages
|
||||
INSP.protocol.all.bases.protocol.must.be.protocols=All bases of a protocol must be protocols
|
||||
INSP.protocol.only.runtime.checkable.protocols.can.be.used.with.instance.class.checks=Only @runtime_checkable protocols can be used with instance and class checks
|
||||
INSP.protocol.newtype.cannot.be.used.with.protocol.classes=NewType cannot be used with protocol classes
|
||||
INSP.protocol.element.type.incompatible.with.protocol=Type of ''{0}'' is incompatible with ''{1}''
|
||||
|
||||
# PyShadowingBuiltinsInspection
|
||||
INSP.NAME.shadowing.builtins=Shadowing built-ins
|
||||
INSP.NAME.shadowing.builtins=Shadowing built-in names
|
||||
INSP.shadowing.builtins.shadows.built.in.name=Shadows built-in name ''{0}''
|
||||
INSP.shadowing.builtins.column.name.ignore.built.ins=Ignore Built-Ins
|
||||
INSP.shadowing.builtins.ignore.built.ins.label=Ignored built-ins:
|
||||
@@ -1003,7 +1003,7 @@ QFIX.NAME.ignore.shadowed.built.in.name=Ignore shadowed built-in name
|
||||
QFIX.ignore.shadowed.built.in.name=Ignore shadowed built-in name "{0}"
|
||||
|
||||
# PyTypeCheckerInspection
|
||||
INSP.NAME.type.checker=Type checker
|
||||
INSP.NAME.type.checker=Incorrect type
|
||||
INSP.type.checker.expected.type.got.type.instead=Expected type ''{0}'', got ''{1}'' instead
|
||||
INSP.type.checker.expected.to.return.type.got.no.return=Expected to return ''{0}'', got no return
|
||||
INSP.type.checker.init.should.return.none=__init__ should return None
|
||||
@@ -1015,7 +1015,7 @@ INSP.type.checker.unexpected.types.prefix=Unexpected type(s):
|
||||
INSP.type.checker.expected.types.prefix=Possible type(s):
|
||||
|
||||
# PyTypedDictInspection
|
||||
INSP.NAME.typed.dict=TypedDict definition and usages
|
||||
INSP.NAME.typed.dict=Invalid TypedDict definition and usages
|
||||
INSP.typeddict.typeddict.key.must.be.string.literal.expected.one=TypedDict key must be a string literal; expected one of ({0})
|
||||
INSP.typeddict.typeddict.has.no.key=TypedDict "{0}" has no key ''{1}''
|
||||
INSP.typeddict.typeddict.has.no.keys=TypedDict "{0}" has no keys ({1})
|
||||
@@ -1035,7 +1035,7 @@ INSP.typeddict.typeddict.cannot.have.key=TypedDict "{0}" cannot have key ''{1}''
|
||||
INSP.typeddict.cannot.add.non.string.key.to.typeddict=Cannot add a non-string key to TypedDict "{0}"
|
||||
|
||||
# PyTypeHintsInspection
|
||||
INSP.NAME.type.hints=Type hints definitions and usages
|
||||
INSP.NAME.type.hints=Invalid type hints definitions and usages
|
||||
INSP.type.hints.builtin.cannot.be.parameterized.directly=Builtin ''{0}'' cannot be parameterized directly
|
||||
INSP.type.hints.invalid.type.self=Invalid type 'self'
|
||||
INSP.type.hints.literal.must.have.at.least.one.parameter='Literal' must have at least one parameter
|
||||
@@ -1103,7 +1103,7 @@ python.find.usages.untyped.probable.usage=Untyped (probable) usage
|
||||
python.find.usages.usage.in.import.statement=Usage in an import statement
|
||||
|
||||
# PyPackagesInspection
|
||||
INSP.NAME.relative.import=Suspicious relative import
|
||||
INSP.NAME.relative.import=Suspicious relative imports
|
||||
INSP.relative.import.relative.import.outside.package=Relative import outside of a package
|
||||
|
||||
debugger.cleaning.signature.cache=Cleaning the Cache of Dynamically Collected Types
|
||||
|
||||
@@ -133,7 +133,12 @@ public class PyQuickFixTest extends PyTestCase {
|
||||
|
||||
// PY-22045
|
||||
public void testBatchReplacePrintInsertsFutureImportOnlyOnce() {
|
||||
doInspectionTest(PyCompatibilityInspection.class, "Fix all 'Code compatibility inspection' problems in file", true, true);
|
||||
doInspectionTest(
|
||||
PyCompatibilityInspection.class,
|
||||
"Fix all 'Code is incompatible with specific Python versions' problems in file",
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// PY-4556
|
||||
|
||||
@@ -157,7 +157,7 @@ class PyTypeHintsQuickFixTest : PyQuickFixTestCase() {
|
||||
// PY-42418
|
||||
fun testBatchReplacingParameterizedBuiltinsWithTheirTypingAliasesBefore39() {
|
||||
doQuickFixTest(PyTypeHintsInspection::class.java,
|
||||
"Fix all 'Type hints definitions and usages' problems in file",
|
||||
"Fix all 'Invalid type hints definitions and usages' problems in file",
|
||||
LanguageLevel.PYTHON38)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user