|
|
|
|
@ -36,7 +36,7 @@ def test(): -> "int":
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20call-non-callable) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L98)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L99)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -58,7 +58,7 @@ Calling a non-callable object will raise a `TypeError` at runtime.
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20conflicting-argument-forms) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L142)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L143)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -88,7 +88,7 @@ f(int) # error
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20conflicting-declarations) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L168)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L169)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -117,7 +117,7 @@ a = 1
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20conflicting-metaclass) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L193)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L194)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -147,7 +147,7 @@ class C(A, B): ...
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20cyclic-class-definition) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L219)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L220)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -177,7 +177,7 @@ class B(A): ...
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20duplicate-base) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L263)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L264)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -202,7 +202,7 @@ class B(A, A): ...
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20duplicate-kw-only) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L284)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L285)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -306,7 +306,7 @@ def test(): -> "Literal[5]":
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20inconsistent-mro) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L426)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L427)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -334,7 +334,7 @@ class C(A, B): ...
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20index-out-of-bounds) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L450)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L451)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -358,7 +358,7 @@ t[3] # IndexError: tuple index out of range
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20instance-layout-conflict) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L316)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L317)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -445,7 +445,7 @@ an atypical memory layout.
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-argument-type) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L470)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L471)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -470,7 +470,7 @@ func("foo") # error: [invalid-argument-type]
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-assignment) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L510)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L511)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -496,7 +496,7 @@ a: int = ''
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-attribute-access) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1514)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1515)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -528,7 +528,7 @@ C.instance_var = 3 # error: Cannot assign to instance variable
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-base) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L532)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L533)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -550,7 +550,7 @@ class A(42): ... # error: [invalid-base]
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-context-manager) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L583)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L584)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -575,7 +575,7 @@ with 1:
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-declaration) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L604)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L605)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -602,7 +602,7 @@ a: str
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-exception-caught) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L627)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L628)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -644,7 +644,7 @@ except ZeroDivisionError:
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-generic-class) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L663)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L664)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -675,7 +675,7 @@ class C[U](Generic[T]): ...
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-legacy-type-variable) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L689)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L690)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -708,7 +708,7 @@ def f(t: TypeVar("U")): ...
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-metaclass) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L738)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L739)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -740,7 +740,7 @@ class B(metaclass=f): ...
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-overload) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L765)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L766)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -788,7 +788,7 @@ def foo(x: int) -> int: ...
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-parameter-default) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L808)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L809)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -812,7 +812,7 @@ def f(a: int = ''): ...
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-protocol) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L398)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L399)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -844,7 +844,7 @@ TypeError: Protocols can only inherit from other protocols, got <class 'int'>
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-raise) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L828)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L829)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
Checks for `raise` statements that raise non-exceptions or use invalid
|
|
|
|
|
@ -891,7 +891,7 @@ def g():
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-return-type) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L491)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L492)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -914,7 +914,7 @@ def func() -> int:
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-super-argument) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L871)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L872)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -968,7 +968,7 @@ TODO #14889
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-type-alias-type) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L717)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L718)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -993,7 +993,7 @@ NewAlias = TypeAliasType(get_name(), int) # error: TypeAliasType name mus
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-type-checking-constant) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L910)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L911)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1021,7 +1021,7 @@ TYPE_CHECKING = ''
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-type-form) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L934)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L935)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1049,7 +1049,7 @@ b: Annotated[int] # `Annotated` expects at least two arguments
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-type-guard-call) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L986)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L987)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1081,7 +1081,7 @@ f(10) # Error
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-type-guard-definition) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L958)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L959)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1113,7 +1113,7 @@ class C:
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20invalid-type-variable-constraints) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1014)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1015)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1146,7 +1146,7 @@ T = TypeVar('T', bound=str) # valid bound TypeVar
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20missing-argument) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1043)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1044)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1169,7 +1169,7 @@ func() # TypeError: func() missing 1 required positional argument: 'x'
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20no-matching-overload) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1062)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1063)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1196,7 +1196,7 @@ func("string") # error: [no-matching-overload]
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20non-subscriptable) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1085)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1086)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1218,7 +1218,7 @@ Subscripting an object that does not support it will raise a `TypeError` at runt
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20not-iterable) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1103)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1104)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1242,7 +1242,7 @@ for i in 34: # TypeError: 'int' object is not iterable
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20parameter-already-assigned) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1154)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1155)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1296,7 +1296,7 @@ def test(): -> "int":
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20static-assert-error) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1490)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1491)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1324,7 +1324,7 @@ static_assert(int(2.0 * 3.0) == 6) # error: does not have a statically known tr
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20subclass-of-final-class) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1245)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1246)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1351,7 +1351,7 @@ class B(A): ... # Error raised here
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20too-many-positional-arguments) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1290)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1291)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1376,7 +1376,7 @@ f("foo") # Error raised here
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20type-assertion-failure) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1268)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1269)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1402,7 +1402,7 @@ def _(x: int):
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20unavailable-implicit-super-arguments) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1311)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1312)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1446,7 +1446,7 @@ class A:
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20unknown-argument) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1368)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1369)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1471,7 +1471,7 @@ f(x=1, y=2) # Error raised here
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20unresolved-attribute) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1389)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1390)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1497,7 +1497,7 @@ A().foo # AttributeError: 'A' object has no attribute 'foo'
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20unresolved-import) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1411)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1412)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1520,7 +1520,7 @@ import foo # ModuleNotFoundError: No module named 'foo'
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20unresolved-reference) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1430)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1431)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1543,7 +1543,7 @@ print(x) # NameError: name 'x' is not defined
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20unsupported-bool-conversion) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1123)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1124)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1578,7 +1578,7 @@ b1 < b2 < b1 # exception raised here
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20unsupported-operator) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1449)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1450)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1604,7 +1604,7 @@ A() + A() # TypeError: unsupported operand type(s) for +: 'A' and 'A'
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`error`](../rules.md#rule-levels "This lint has a default level of 'error'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20zero-stepsize-in-slice) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1471)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1472)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1655,7 +1655,7 @@ a = 20 / 0 # type: ignore
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`warn`](../rules.md#rule-levels "This lint has a default level of 'warn'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20possibly-unbound-attribute) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1175)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1176)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1681,7 +1681,7 @@ A.c # AttributeError: type object 'A' has no attribute 'c'
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`warn`](../rules.md#rule-levels "This lint has a default level of 'warn'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20possibly-unbound-implicit-call) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L116)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L117)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1711,7 +1711,7 @@ A()[0] # TypeError: 'A' object is not subscriptable
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`warn`](../rules.md#rule-levels "This lint has a default level of 'warn'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20possibly-unbound-import) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1197)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1198)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1741,7 +1741,7 @@ from module import a # ImportError: cannot import name 'a' from 'module'
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`warn`](../rules.md#rule-levels "This lint has a default level of 'warn'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20redundant-cast) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1542)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1543)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1766,7 +1766,7 @@ cast(int, f()) # Redundant
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`warn`](../rules.md#rule-levels "This lint has a default level of 'warn'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20undefined-reveal) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1350)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1351)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1812,12 +1812,66 @@ Use instead:
|
|
|
|
|
a = 20 / 0 # ty: ignore[division-by-zero]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## `unresolved-global`
|
|
|
|
|
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`warn`](../rules.md#rule-levels "This lint has a default level of 'warn'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20unresolved-global) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1564)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
|
|
|
|
|
Detects variables declared as `global` in an inner scope that have no explicit
|
|
|
|
|
bindings or declarations in the global scope.
|
|
|
|
|
|
|
|
|
|
**Why is this bad?**
|
|
|
|
|
|
|
|
|
|
Function bodies with `global` statements can run in any order (or not at all), which makes
|
|
|
|
|
it hard for static analysis tools to infer the types of globals without
|
|
|
|
|
explicit definitions or declarations.
|
|
|
|
|
|
|
|
|
|
**Example**
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
def f():
|
|
|
|
|
global x # unresolved global
|
|
|
|
|
x = 42
|
|
|
|
|
|
|
|
|
|
def g():
|
|
|
|
|
print(x) # unresolved reference
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Use instead:
|
|
|
|
|
```python
|
|
|
|
|
x: int
|
|
|
|
|
|
|
|
|
|
def f():
|
|
|
|
|
global x
|
|
|
|
|
x = 42
|
|
|
|
|
|
|
|
|
|
def g():
|
|
|
|
|
print(x)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Or:
|
|
|
|
|
```python
|
|
|
|
|
x: int | None = None
|
|
|
|
|
|
|
|
|
|
def f():
|
|
|
|
|
global x
|
|
|
|
|
x = 42
|
|
|
|
|
|
|
|
|
|
def g():
|
|
|
|
|
print(x)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## `unsupported-base`
|
|
|
|
|
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`warn`](../rules.md#rule-levels "This lint has a default level of 'warn'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20unsupported-base) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L550)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L551)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1854,7 +1908,7 @@ class D(C): ... # error: [unsupported-base]
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`ignore`](../rules.md#rule-levels "This lint has a default level of 'ignore'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20division-by-zero) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L245)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L246)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
@ -1876,7 +1930,7 @@ Dividing by zero raises a `ZeroDivisionError` at runtime.
|
|
|
|
|
<small>
|
|
|
|
|
Default level: [`ignore`](../rules.md#rule-levels "This lint has a default level of 'ignore'.") ·
|
|
|
|
|
[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20possibly-unresolved-reference) ·
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1223)
|
|
|
|
|
[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1224)
|
|
|
|
|
</small>
|
|
|
|
|
|
|
|
|
|
**What it does**
|
|
|
|
|
|