mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Minor fixes in inspection messages (PY-27398)
This commit is contained in:
@@ -99,13 +99,13 @@ class PyDataclassInspection : PyInspection() {
|
||||
leftDataclassParameters != null &&
|
||||
parseDataclassParameters(rightClass, myTypeEvalContext) != null) {
|
||||
registerProblem(node.psiOperator,
|
||||
"${node.referencedName} not supported between instances of '${leftClass.name}' and '${rightClass.name}'",
|
||||
"'${node.referencedName}' not supported between instances of '${leftClass.name}' and '${rightClass.name}'",
|
||||
ProblemHighlightType.GENERIC_ERROR)
|
||||
}
|
||||
|
||||
if (leftClass == rightClass && leftDataclassParameters?.order == false) {
|
||||
registerProblem(node.psiOperator,
|
||||
"${node.referencedName} not supported between instances of '${leftClass.name}'",
|
||||
"'${node.referencedName}' not supported between instances of '${leftClass.name}'",
|
||||
ProblemHighlightType.GENERIC_ERROR)
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ class PyDataclassInspection : PyInspection() {
|
||||
if (!dataclassParameters.eq && dataclassParameters.order) {
|
||||
val eqArgument = dataclassParameters.eqArgument
|
||||
if (eqArgument != null) {
|
||||
registerProblem(eqArgument, "eq must be true if order is true", ProblemHighlightType.GENERIC_ERROR)
|
||||
registerProblem(eqArgument, "'eq' must be true if 'order' is true", ProblemHighlightType.GENERIC_ERROR)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ class PyDataclassInspection : PyInspection() {
|
||||
valueClass == builtinCache.setType?.pyClass ||
|
||||
valueClass == builtinCache.tupleType?.pyClass) {
|
||||
registerProblem(value,
|
||||
"mutable default '${valueClass.name}' is not allowed",
|
||||
"Mutable default '${valueClass.name}' is not allowed",
|
||||
ProblemHighlightType.GENERIC_ERROR)
|
||||
}
|
||||
}
|
||||
@@ -194,7 +194,7 @@ class PyDataclassInspection : PyInspection() {
|
||||
if (type is PyClassType && type.classQName == DATACLASSES_INITVAR_TYPE) {
|
||||
if (postInit == null) {
|
||||
registerProblem(field,
|
||||
"attribute '${field.name}' is useless until '${DUNDER_POST_INIT}' is declared",
|
||||
"Attribute '${field.name}' is useless until '${DUNDER_POST_INIT}' is declared",
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL)
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ class PyDataclassInspection : PyInspection() {
|
||||
if (fieldStub != null && fieldStub.hasDefault() && fieldStub.hasDefaultFactory()) {
|
||||
val call = field.findAssignedValue() as? PyCallExpression ?: return
|
||||
|
||||
registerProblem(call.argumentList, "cannot specify both default and default_factory", ProblemHighlightType.GENERIC_ERROR)
|
||||
registerProblem(call.argumentList, "Cannot specify both 'default' and 'default_factory'", ProblemHighlightType.GENERIC_ERROR)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ print(A1(1) > A1(2))
|
||||
print(A1(1) >= A1(2))
|
||||
|
||||
|
||||
print(A1(1) <error descr="__lt__ not supported between instances of 'A1' and 'A2'"><</error> A2(2))
|
||||
print(A1(1) <error descr="__le__ not supported between instances of 'A1' and 'A2'"><=</error> A2(2))
|
||||
print(A1(1) <error descr="__gt__ not supported between instances of 'A1' and 'A2'">></error> A2(2))
|
||||
print(A1(1) <error descr="__ge__ not supported between instances of 'A1' and 'A2'">>=</error> A2(2))
|
||||
print(A1(1) <error descr="'__lt__' not supported between instances of 'A1' and 'A2'"><</error> A2(2))
|
||||
print(A1(1) <error descr="'__le__' not supported between instances of 'A1' and 'A2'"><=</error> A2(2))
|
||||
print(A1(1) <error descr="'__gt__' not supported between instances of 'A1' and 'A2'">></error> A2(2))
|
||||
print(A1(1) <error descr="'__ge__' not supported between instances of 'A1' and 'A2'">>=</error> A2(2))
|
||||
|
||||
|
||||
print(A1 < A1)
|
||||
|
||||
+4
-4
@@ -10,10 +10,10 @@ class A2:
|
||||
y: int = 0
|
||||
|
||||
|
||||
print(A1(1) <error descr="__lt__ not supported between instances of 'A1' and 'A2'"><</error> A2(2))
|
||||
print(A1(1) <error descr="__le__ not supported between instances of 'A1' and 'A2'"><=</error> A2(2))
|
||||
print(A1(1) <error descr="__gt__ not supported between instances of 'A1' and 'A2'">></error> A2(2))
|
||||
print(A1(1) <error descr="__ge__ not supported between instances of 'A1' and 'A2'">>=</error> A2(2))
|
||||
print(A1(1) <error descr="'__lt__' not supported between instances of 'A1' and 'A2'"><</error> A2(2))
|
||||
print(A1(1) <error descr="'__le__' not supported between instances of 'A1' and 'A2'"><=</error> A2(2))
|
||||
print(A1(1) <error descr="'__gt__' not supported between instances of 'A1' and 'A2'">></error> A2(2))
|
||||
print(A1(1) <error descr="'__ge__' not supported between instances of 'A1' and 'A2'">>=</error> A2(2))
|
||||
|
||||
|
||||
print(A1 < A2)
|
||||
|
||||
@@ -10,16 +10,16 @@ class A2:
|
||||
y: int = 0
|
||||
|
||||
|
||||
print(A1(1) <error descr="__lt__ not supported between instances of 'A1'"><</error> A1(2))
|
||||
print(A1(1) <error descr="__le__ not supported between instances of 'A1'"><=</error> A1(2))
|
||||
print(A1(1) <error descr="__gt__ not supported between instances of 'A1'">></error> A1(2))
|
||||
print(A1(1) <error descr="__ge__ not supported between instances of 'A1'">>=</error> A1(2))
|
||||
print(A1(1) <error descr="'__lt__' not supported between instances of 'A1'"><</error> A1(2))
|
||||
print(A1(1) <error descr="'__le__' not supported between instances of 'A1'"><=</error> A1(2))
|
||||
print(A1(1) <error descr="'__gt__' not supported between instances of 'A1'">></error> A1(2))
|
||||
print(A1(1) <error descr="'__ge__' not supported between instances of 'A1'">>=</error> A1(2))
|
||||
|
||||
|
||||
print(A1(1) <error descr="__lt__ not supported between instances of 'A1' and 'A2'"><</error> A2(2))
|
||||
print(A1(1) <error descr="__le__ not supported between instances of 'A1' and 'A2'"><=</error> A2(2))
|
||||
print(A1(1) <error descr="__gt__ not supported between instances of 'A1' and 'A2'">></error> A2(2))
|
||||
print(A1(1) <error descr="__ge__ not supported between instances of 'A1' and 'A2'">>=</error> A2(2))
|
||||
print(A1(1) <error descr="'__lt__' not supported between instances of 'A1' and 'A2'"><</error> A2(2))
|
||||
print(A1(1) <error descr="'__le__' not supported between instances of 'A1' and 'A2'"><=</error> A2(2))
|
||||
print(A1(1) <error descr="'__gt__' not supported between instances of 'A1' and 'A2'">></error> A2(2))
|
||||
print(A1(1) <error descr="'__ge__' not supported between instances of 'A1' and 'A2'">>=</error> A2(2))
|
||||
|
||||
|
||||
print(A1 < A1)
|
||||
|
||||
@@ -4,12 +4,12 @@ from typing import ClassVar, List, Set, Tuple, Type
|
||||
|
||||
@dataclasses.dataclass
|
||||
class A:
|
||||
a: List[int] = <error descr="mutable default 'list' is not allowed">[]</error>
|
||||
b: List[int] = <error descr="mutable default 'list' is not allowed">list()</error>
|
||||
c: Set[int] = <error descr="mutable default 'set' is not allowed">{1}</error>
|
||||
d: Set[int] = <error descr="mutable default 'set' is not allowed">set()</error>
|
||||
e: Tuple[int, ...] = <error descr="mutable default 'tuple' is not allowed">()</error>
|
||||
f: Tuple[int, ...] = <error descr="mutable default 'tuple' is not allowed">tuple()</error>
|
||||
a: List[int] = <error descr="Mutable default 'list' is not allowed">[]</error>
|
||||
b: List[int] = <error descr="Mutable default 'list' is not allowed">list()</error>
|
||||
c: Set[int] = <error descr="Mutable default 'set' is not allowed">{1}</error>
|
||||
d: Set[int] = <error descr="Mutable default 'set' is not allowed">set()</error>
|
||||
e: Tuple[int, ...] = <error descr="Mutable default 'tuple' is not allowed">()</error>
|
||||
f: Tuple[int, ...] = <error descr="Mutable default 'tuple' is not allowed">tuple()</error>
|
||||
g: ClassVar[List[int]] = []
|
||||
h: ClassVar = []
|
||||
a2: Type[List[int]] = list
|
||||
|
||||
@@ -4,4 +4,4 @@ import dataclasses
|
||||
class E1:
|
||||
a: int = dataclasses.field(default=1)
|
||||
b: int = dataclasses.field(default_factory=int)
|
||||
c: int = dataclasses.field<error descr="cannot specify both default and default_factory">(default=1, default_factory=int)</error>
|
||||
c: int = dataclasses.field<error descr="Cannot specify both 'default' and 'default_factory'">(default=1, default_factory=int)</error>
|
||||
@@ -1,7 +1,7 @@
|
||||
import dataclasses
|
||||
|
||||
|
||||
@dataclasses.dataclass(<error descr="eq must be true if order is true">eq=False</error>, order=True)
|
||||
@dataclasses.dataclass(<error descr="'eq' must be true if 'order' is true">eq=False</error>, order=True)
|
||||
class A1:
|
||||
x: int
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@ import dataclasses
|
||||
@dataclasses.dataclass
|
||||
class A:
|
||||
a: int
|
||||
<warning descr="attribute 'b' is useless until '__post_init__' is declared">b</warning>: dataclasses.InitVar[str]
|
||||
<warning descr="Attribute 'b' is useless until '__post_init__' is declared">b</warning>: dataclasses.InitVar[str]
|
||||
|
||||
Reference in New Issue
Block a user