diff --git a/crates/ruff_dev/src/generate_ty_rules.rs b/crates/ruff_dev/src/generate_ty_rules.rs
index aaa1021d96..22394de203 100644
--- a/crates/ruff_dev/src/generate_ty_rules.rs
+++ b/crates/ruff_dev/src/generate_ty_rules.rs
@@ -93,14 +93,39 @@ fn generate_markdown() -> String {
})
.join("\n");
+ let status_text = match lint.status() {
+ ty_python_semantic::lint::LintStatus::Stable { since } => {
+ format!(
+ r#"Added in {since}"#
+ )
+ }
+ ty_python_semantic::lint::LintStatus::Preview { since } => {
+ format!(
+ r#"Preview (since {since})"#
+ )
+ }
+ ty_python_semantic::lint::LintStatus::Deprecated { since, .. } => {
+ format!(
+ r#"Deprecated (since {since})"#
+ )
+ }
+ ty_python_semantic::lint::LintStatus::Removed { since, .. } => {
+ format!(
+ r#"Removed (since {since})"#
+ )
+ }
+ };
+
let _ = writeln!(
&mut output,
r#"
-Default level: [`{level}`](../rules.md#rule-levels "This lint has a default level of '{level}'.") ·
-[Related issues](https://github.com/astral-sh/ty/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20{encoded_name}) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/{file}#L{line})
+Default level: {level} ·
+{status_text} ·
+Related issues ·
+View source
+
{documentation}
"#,
level = lint.default_level(),
diff --git a/crates/ty/docs/rules.md b/crates/ty/docs/rules.md
index cc35151b54..8ae4ba1da5 100644
--- a/crates/ty/docs/rules.md
+++ b/crates/ty/docs/rules.md
@@ -5,11 +5,13 @@
## `byte-string-type-annotation`
-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%20byte-string-type-annotation) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fstring_annotation.rs#L36)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for byte-strings in type annotation positions.
@@ -34,11 +36,13 @@ def test(): -> "int":
## `call-non-callable`
-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#L115)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for calls to non-callable objects.
@@ -56,11 +60,13 @@ Calling a non-callable object will raise a `TypeError` at runtime.
## `conflicting-argument-forms`
-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#L159)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks whether an argument is used as both a value and a type form in a call.
@@ -86,11 +92,13 @@ f(int) # error
## `conflicting-declarations`
-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#L185)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks whether a variable has been declared as two conflicting types.
@@ -115,11 +123,13 @@ a = 1
## `conflicting-metaclass`
-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#L210)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for class definitions where the metaclass of the class
@@ -145,11 +155,13 @@ class C(A, B): ...
## `cyclic-class-definition`
-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#L236)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for class definitions in stub files that inherit
@@ -175,11 +187,13 @@ class B(A): ...
## `duplicate-base`
-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#L301)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for class definitions with duplicate bases.
@@ -200,11 +214,13 @@ class B(A, A): ...
## `duplicate-kw-only`
-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#L322)
+Default level: error ·
+Added in 0.0.1-alpha.12 ·
+Related issues ·
+View source
+
**What it does**
Checks for dataclass definitions with more than one field
@@ -236,21 +252,25 @@ class A: # Crash at runtime
## `escape-character-in-forward-annotation`
-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%20escape-character-in-forward-annotation) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fstring_annotation.rs#L120)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
TODO #14889
## `fstring-type-annotation`
-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%20fstring-type-annotation) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fstring_annotation.rs#L11)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for f-strings in type annotation positions.
@@ -275,11 +295,13 @@ def test(): -> "int":
## `implicit-concatenated-string-type-annotation`
-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%20implicit-concatenated-string-type-annotation) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fstring_annotation.rs#L86)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for implicit concatenated strings in type annotation positions.
@@ -304,11 +326,13 @@ def test(): -> "Literal[5]":
## `inconsistent-mro`
-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#L525)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for classes with an inconsistent [method resolution order] (MRO).
@@ -332,11 +356,13 @@ class C(A, B): ...
## `index-out-of-bounds`
-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#L549)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for attempts to use an out of bounds index to get an item from
@@ -356,11 +382,13 @@ t[3] # IndexError: tuple index out of range
## `instance-layout-conflict`
-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#L354)
+Default level: error ·
+Added in 0.0.1-alpha.12 ·
+Related issues ·
+View source
+
**What it does**
Checks for classes definitions which will fail at runtime due to
@@ -443,11 +471,13 @@ an atypical memory layout.
## `invalid-argument-type`
-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#L594)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Detects call arguments whose type is not assignable to the corresponding typed parameter.
@@ -468,11 +498,13 @@ func("foo") # error: [invalid-argument-type]
## `invalid-assignment`
-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#L634)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for assignments where the type of the value
@@ -494,11 +526,13 @@ a: int = ''
## `invalid-attribute-access`
-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#L1745)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for assignments to class variables from instances
@@ -526,11 +560,13 @@ C.instance_var = 3 # error: Cannot assign to instance variable
## `invalid-await`
-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-await) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L656)
+Default level: error ·
+Added in 0.0.1-alpha.19 ·
+Related issues ·
+View source
+
**What it does**
Checks for `await` being used with types that are not [Awaitable].
@@ -560,11 +596,13 @@ asyncio.run(main())
## `invalid-base`
-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#L686)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for class definitions that have bases which are not instances of `type`.
@@ -582,11 +620,13 @@ class A(42): ... # error: [invalid-base]
## `invalid-context-manager`
-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#L737)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for expressions used in `with` statements
@@ -607,11 +647,13 @@ with 1:
## `invalid-declaration`
-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#L758)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for declarations where the inferred type of an existing symbol
@@ -634,11 +676,13 @@ a: str
## `invalid-exception-caught`
-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#L781)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for exception handlers that catch non-exception classes.
@@ -676,11 +720,13 @@ except ZeroDivisionError:
## `invalid-generic-class`
-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#L817)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for the creation of invalid generic classes
@@ -707,11 +753,13 @@ class C[U](Generic[T]): ...
## `invalid-key`
-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-key) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L569)
+Default level: error ·
+Added in 0.0.1-alpha.17 ·
+Related issues ·
+View source
+
**What it does**
Checks for subscript accesses with invalid keys.
@@ -736,11 +784,13 @@ alice["height"] # KeyError: 'height'
## `invalid-legacy-type-variable`
-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#L843)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for the creation of invalid legacy `TypeVar`s
@@ -769,11 +819,13 @@ def f(t: TypeVar("U")): ...
## `invalid-metaclass`
-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#L892)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for arguments to `metaclass=` that are invalid.
@@ -801,11 +853,13 @@ class B(metaclass=f): ...
## `invalid-named-tuple`
-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-named-tuple) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L499)
+Default level: error ·
+Added in 0.0.1-alpha.19 ·
+Related issues ·
+View source
+
**What it does**
Checks for invalidly defined `NamedTuple` classes.
@@ -831,11 +885,13 @@ TypeError: can only inherit from a NamedTuple type and Generic
## `invalid-overload`
-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#L919)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for various invalid `@overload` usages.
@@ -879,11 +935,13 @@ def foo(x: int) -> int: ...
## `invalid-parameter-default`
-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#L1018)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for default values that can't be
@@ -903,11 +961,13 @@ def f(a: int = ''): ...
## `invalid-protocol`
-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#L436)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for protocol classes that will raise `TypeError` at runtime.
@@ -935,11 +995,13 @@ TypeError: Protocols can only inherit from other protocols, got
## `invalid-raise`
-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#L1038)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
Checks for `raise` statements that raise non-exceptions or use invalid
causes for their raised exceptions.
@@ -982,11 +1044,13 @@ def g():
## `invalid-return-type`
-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#L615)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Detects returned values that can't be assigned to the function's annotated return type.
@@ -1005,11 +1069,13 @@ def func() -> int:
## `invalid-super-argument`
-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#L1081)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Detects `super()` calls where:
@@ -1049,21 +1115,25 @@ super(B, A) # error: `A` does not satisfy `issubclass(A, B)`
## `invalid-syntax-in-forward-annotation`
-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-syntax-in-forward-annotation) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fstring_annotation.rs#L111)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
TODO #14889
## `invalid-type-alias-type`
-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#L871)
+Default level: error ·
+Added in 0.0.1-alpha.6 ·
+Related issues ·
+View source
+
**What it does**
Checks for the creation of invalid `TypeAliasType`s
@@ -1084,11 +1154,13 @@ NewAlias = TypeAliasType(get_name(), int) # error: TypeAliasType name mus
## `invalid-type-checking-constant`
-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#L1120)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for a value other than `False` assigned to the `TYPE_CHECKING` variable, or an
@@ -1112,11 +1184,13 @@ TYPE_CHECKING = ''
## `invalid-type-form`
-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#L1144)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for expressions that are used as [type expressions]
@@ -1140,11 +1214,13 @@ b: Annotated[int] # `Annotated` expects at least two arguments
## `invalid-type-guard-call`
-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#L1196)
+Default level: error ·
+Added in 0.0.1-alpha.11 ·
+Related issues ·
+View source
+
**What it does**
Checks for type guard function calls without a valid target.
@@ -1172,11 +1248,13 @@ f(10) # Error
## `invalid-type-guard-definition`
-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#L1168)
+Default level: error ·
+Added in 0.0.1-alpha.11 ·
+Related issues ·
+View source
+
**What it does**
Checks for type guard functions without
@@ -1204,11 +1282,13 @@ class C:
## `invalid-type-variable-constraints`
-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#L1224)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for constrained [type variables] with only one constraint.
@@ -1237,11 +1317,13 @@ T = TypeVar('T', bound=str) # valid bound TypeVar
## `missing-argument`
-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#L1253)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for missing required arguments in a call.
@@ -1260,11 +1342,13 @@ func() # TypeError: func() missing 1 required positional argument: 'x'
## `missing-typed-dict-key`
-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-typed-dict-key) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1844)
+Default level: error ·
+Added in 0.0.1-alpha.20 ·
+Related issues ·
+View source
+
**What it does**
Detects missing required keys in `TypedDict` constructor calls.
@@ -1291,11 +1375,13 @@ alice["age"] # KeyError
## `no-matching-overload`
-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#L1272)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for calls to an overloaded function that do not match any of the overloads.
@@ -1318,11 +1404,13 @@ func("string") # error: [no-matching-overload]
## `non-subscriptable`
-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#L1295)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for subscripting objects that do not support subscripting.
@@ -1340,11 +1428,13 @@ Subscripting an object that does not support it will raise a `TypeError` at runt
## `not-iterable`
-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#L1313)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for objects that are not iterable but are used in a context that requires them to be.
@@ -1364,11 +1454,13 @@ for i in 34: # TypeError: 'int' object is not iterable
## `parameter-already-assigned`
-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#L1364)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for calls which provide more than one argument for a single parameter.
@@ -1389,11 +1481,13 @@ f(1, x=2) # Error raised here
## `positional-only-parameter-as-kwarg`
-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%20positional-only-parameter-as-kwarg) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1599)
+Default level: error ·
+Added in 0.0.1-alpha.22 ·
+Related issues ·
+View source
+
**What it does**
Checks for keyword arguments in calls that match positional-only parameters of the callable.
@@ -1414,11 +1508,13 @@ f(x=1) # Error raised here
## `raw-string-type-annotation`
-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%20raw-string-type-annotation) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fstring_annotation.rs#L61)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for raw-strings in type annotation positions.
@@ -1443,11 +1539,13 @@ def test(): -> "int":
## `static-assert-error`
-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#L1721)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Makes sure that the argument of `static_assert` is statically known to be true.
@@ -1471,11 +1569,13 @@ static_assert(int(2.0 * 3.0) == 6) # error: does not have a statically known tr
## `subclass-of-final-class`
-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#L1455)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for classes that subclass final classes.
@@ -1498,11 +1598,13 @@ class B(A): ... # Error raised here
## `too-many-positional-arguments`
-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#L1500)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for calls that pass more positional arguments than the callable can accept.
@@ -1523,11 +1625,13 @@ f("foo") # Error raised here
## `type-assertion-failure`
-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#L1478)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for `assert_type()` and `assert_never()` calls where the actual type
@@ -1549,11 +1653,13 @@ def _(x: int):
## `unavailable-implicit-super-arguments`
-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#L1521)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Detects invalid `super()` calls where implicit arguments like the enclosing class or first method argument are unavailable.
@@ -1593,11 +1699,13 @@ class A:
## `unknown-argument`
-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#L1578)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for keyword arguments in calls that don't match any parameter of the callable.
@@ -1618,11 +1726,13 @@ f(x=1, y=2) # Error raised here
## `unresolved-attribute`
-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#L1620)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for unresolved attributes.
@@ -1644,11 +1754,13 @@ A().foo # AttributeError: 'A' object has no attribute 'foo'
## `unresolved-import`
-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#L1642)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for import statements for which the module cannot be resolved.
@@ -1667,11 +1779,13 @@ import foo # ModuleNotFoundError: No module named 'foo'
## `unresolved-reference`
-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#L1661)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for references to names that are not defined.
@@ -1690,11 +1804,13 @@ print(x) # NameError: name 'x' is not defined
## `unsupported-bool-conversion`
-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#L1333)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for bool conversions where the object doesn't correctly implement `__bool__`.
@@ -1725,11 +1841,13 @@ b1 < b2 < b1 # exception raised here
## `unsupported-operator`
-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#L1680)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for binary expressions, comparisons, and unary expressions where
@@ -1751,11 +1869,13 @@ A() + A() # TypeError: unsupported operand type(s) for +: 'A' and 'A'
## `zero-stepsize-in-slice`
-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#L1702)
+Default level: error ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for step size 0 in slices.
@@ -1774,11 +1894,13 @@ l[1:10:0] # ValueError: slice step cannot be zero
## `ambiguous-protocol-member`
-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%20ambiguous-protocol-member) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L464)
+Default level: warn ·
+Added in 0.0.1-alpha.20 ·
+Related issues ·
+View source
+
**What it does**
Checks for protocol classes with members that will lead to ambiguous interfaces.
@@ -1813,11 +1935,13 @@ class SubProto(BaseProto, Protocol):
## `deprecated`
-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%20deprecated) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L280)
+Default level: warn ·
+Added in 0.0.1-alpha.16 ·
+Related issues ·
+View source
+
**What it does**
Checks for uses of deprecated items
@@ -1838,11 +1962,13 @@ old_func() # emits [deprecated] diagnostic
## `invalid-ignore-comment`
-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%20invalid-ignore-comment) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Fsuppression.rs#L65)
+Default level: warn ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for `type: ignore` and `ty: ignore` comments that are syntactically incorrect.
@@ -1866,11 +1992,13 @@ a = 20 / 0 # type: ignore
## `possibly-missing-attribute`
-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-missing-attribute) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1385)
+Default level: warn ·
+Added in 0.0.1-alpha.22 ·
+Related issues ·
+View source
+
**What it does**
Checks for possibly missing attributes.
@@ -1892,11 +2020,13 @@ A.c # AttributeError: type object 'A' has no attribute 'c'
## `possibly-missing-implicit-call`
-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-missing-implicit-call) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L133)
+Default level: warn ·
+Added in 0.0.1-alpha.22 ·
+Related issues ·
+View source
+
**What it does**
Checks for implicit calls to possibly missing methods.
@@ -1922,11 +2052,13 @@ A()[0] # TypeError: 'A' object is not subscriptable
## `possibly-missing-import`
-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-missing-import) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L1407)
+Default level: warn ·
+Added in 0.0.1-alpha.22 ·
+Related issues ·
+View source
+
**What it does**
Checks for imports of symbols that may be missing.
@@ -1952,11 +2084,13 @@ from module import a # ImportError: cannot import name 'a' from 'module'
## `redundant-cast`
-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#L1773)
+Default level: warn ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Detects redundant `cast` calls where the value already has the target type.
@@ -1977,11 +2111,13 @@ cast(int, f()) # Redundant
## `undefined-reveal`
-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#L1560)
+Default level: warn ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for calls to `reveal_type` without importing it.
@@ -1999,11 +2135,13 @@ reveal_type(1) # NameError: name 'reveal_type' is not defined
## `unknown-rule`
-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%20unknown-rule) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Fsuppression.rs#L40)
+Default level: warn ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for `ty: ignore[code]` where `code` isn't a known lint rule.
@@ -2028,11 +2166,13 @@ a = 20 / 0 # ty: ignore[division-by-zero]
## `unresolved-global`
-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#L1794)
+Default level: warn ·
+Added in 0.0.1-alpha.15 ·
+Related issues ·
+View source
+
**What it does**
Detects variables declared as `global` in an inner scope that have no explicit
@@ -2056,6 +2196,7 @@ def g():
```
Use instead:
+
```python
x: int
@@ -2068,6 +2209,7 @@ def g():
```
Or:
+
```python
x: int | None = None
@@ -2082,11 +2224,13 @@ def g():
## `unsupported-base`
-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#L704)
+Default level: warn ·
+Added in 0.0.1-alpha.7 ·
+Related issues ·
+View source
+
**What it does**
Checks for class definitions that have bases which are unsupported by ty.
@@ -2119,11 +2263,13 @@ class D(C): ... # error: [unsupported-base]
## `useless-overload-body`
-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%20useless-overload-body) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Ftypes%2Fdiagnostic.rs#L962)
+Default level: warn ·
+Added in 0.0.1-alpha.22 ·
+Related issues ·
+View source
+
**What it does**
Checks for various `@overload`-decorated functions that have non-stub bodies.
@@ -2180,11 +2326,13 @@ def foo(x: int | str) -> int | str:
## `division-by-zero`
-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#L262)
+Default level: ignore ·
+Preview (since 0.0.1-alpha.1) ·
+Related issues ·
+View source
+
**What it does**
It detects division by zero.
@@ -2202,11 +2350,13 @@ Dividing by zero raises a `ZeroDivisionError` at runtime.
## `possibly-unresolved-reference`
-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#L1433)
+Default level: ignore ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for references to names that are possibly not defined.
@@ -2228,11 +2378,13 @@ print(x) # NameError: name 'x' is not defined
## `unused-ignore-comment`
-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%20unused-ignore-comment) ·
-[View source](https://github.com/astral-sh/ruff/blob/main/crates%2Fty_python_semantic%2Fsrc%2Fsuppression.rs#L15)
+Default level: ignore ·
+Added in 0.0.1-alpha.1 ·
+Related issues ·
+View source
+
**What it does**
Checks for `type: ignore` or `ty: ignore` directives that are no longer applicable.
diff --git a/crates/ty_python_semantic/src/suppression.rs b/crates/ty_python_semantic/src/suppression.rs
index d0f5447cc0..cf33190c82 100644
--- a/crates/ty_python_semantic/src/suppression.rs
+++ b/crates/ty_python_semantic/src/suppression.rs
@@ -32,7 +32,7 @@ declare_lint! {
/// ```
pub(crate) static UNUSED_IGNORE_COMMENT = {
summary: "detects unused `type: ignore` comments",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Ignore,
}
}
@@ -57,7 +57,7 @@ declare_lint! {
/// ```
pub(crate) static UNKNOWN_RULE = {
summary: "detects `ty: ignore` comments that reference unknown rules",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Warn,
}
}
@@ -81,7 +81,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_IGNORE_COMMENT = {
summary: "detects ignore comments that use invalid syntax",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Warn,
}
}
diff --git a/crates/ty_python_semantic/src/types/diagnostic.rs b/crates/ty_python_semantic/src/types/diagnostic.rs
index 982c76672d..cb1b5b6a0d 100644
--- a/crates/ty_python_semantic/src/types/diagnostic.rs
+++ b/crates/ty_python_semantic/src/types/diagnostic.rs
@@ -125,7 +125,7 @@ declare_lint! {
/// ```
pub(crate) static CALL_NON_CALLABLE = {
summary: "detects calls to non-callable objects",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -151,7 +151,7 @@ declare_lint! {
/// ```
pub(crate) static POSSIBLY_MISSING_IMPLICIT_CALL = {
summary: "detects implicit calls to possibly missing methods",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.22"),
default_level: Level::Warn,
}
}
@@ -177,7 +177,7 @@ declare_lint! {
/// ```
pub(crate) static CONFLICTING_ARGUMENT_FORMS = {
summary: "detects when an argument is used as both a value and a type form in a call",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -202,7 +202,7 @@ declare_lint! {
/// ```
pub(crate) static CONFLICTING_DECLARATIONS = {
summary: "detects conflicting declarations",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -228,7 +228,7 @@ declare_lint! {
/// ```
pub(crate) static CONFLICTING_METACLASS = {
summary: "detects conflicting metaclasses",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -254,7 +254,7 @@ declare_lint! {
/// [method resolution order]: https://docs.python.org/3/glossary.html#term-method-resolution-order
pub(crate) static CYCLIC_CLASS_DEFINITION = {
summary: "detects cyclic class definitions",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -272,7 +272,7 @@ declare_lint! {
/// ```
pub(crate) static DIVISION_BY_ZERO = {
summary: "detects division by zero",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::preview("0.0.1-alpha.1"),
default_level: Level::Ignore,
}
}
@@ -293,7 +293,7 @@ declare_lint! {
/// ```
pub(crate) static DEPRECATED = {
summary: "detects uses of deprecated items",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.16"),
default_level: Level::Warn,
}
}
@@ -314,7 +314,7 @@ declare_lint! {
/// ```
pub(crate) static DUPLICATE_BASE = {
summary: "detects class definitions with duplicate bases",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -346,7 +346,7 @@ declare_lint! {
/// ```
pub(crate) static DUPLICATE_KW_ONLY = {
summary: "detects dataclass definitions with more than one usage of `KW_ONLY`",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.12"),
default_level: Level::Error,
}
}
@@ -428,7 +428,7 @@ declare_lint! {
/// [Method Resolution Order]: https://docs.python.org/3/glossary.html#term-method-resolution-order
pub(crate) static INSTANCE_LAYOUT_CONFLICT = {
summary: "detects class definitions that raise `TypeError` due to instance layout conflict",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.12"),
default_level: Level::Error,
}
}
@@ -456,11 +456,12 @@ declare_lint! {
/// ```
pub(crate) static INVALID_PROTOCOL = {
summary: "detects invalid protocol class definitions",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
+// Added in #17750.
declare_lint! {
/// ## What it does
/// Checks for protocol classes with members that will lead to ambiguous interfaces.
@@ -491,7 +492,7 @@ declare_lint! {
/// ```
pub(crate) static AMBIGUOUS_PROTOCOL_MEMBER = {
summary: "detects protocol classes with ambiguous interfaces",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.20"),
default_level: Level::Warn,
}
}
@@ -517,7 +518,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_NAMED_TUPLE = {
summary: "detects invalid `NamedTuple` class definitions",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.19"),
default_level: Level::Error,
}
}
@@ -541,7 +542,7 @@ declare_lint! {
/// [method resolution order]: https://docs.python.org/3/glossary.html#term-method-resolution-order
pub(crate) static INCONSISTENT_MRO = {
summary: "detects class definitions with an inconsistent MRO",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -561,11 +562,12 @@ declare_lint! {
/// ```
pub(crate) static INDEX_OUT_OF_BOUNDS = {
summary: "detects index out of bounds errors",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
+// Added in #19763.
declare_lint! {
/// ## What it does
/// Checks for subscript accesses with invalid keys.
@@ -586,7 +588,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_KEY = {
summary: "detects invalid subscript accesses",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.17"),
default_level: Level::Error,
}
}
@@ -607,7 +609,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_ARGUMENT_TYPE = {
summary: "detects call arguments whose type is not assignable to the corresponding typed parameter",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -626,7 +628,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_RETURN_TYPE = {
summary: "detects returned values that can't be assigned to the function's annotated return type",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -648,7 +650,7 @@ declare_lint! {
/// [assignable to]: https://typing.python.org/en/latest/spec/glossary.html#term-assignable
pub(crate) static INVALID_ASSIGNMENT = {
summary: "detects invalid assignments",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -678,7 +680,7 @@ declare_lint! {
/// [Awaitable]: https://docs.python.org/3/library/collections.abc.html#collections.abc.Awaitable
pub(crate) static INVALID_AWAIT = {
summary: "detects awaiting on types that don't support it",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.19"),
default_level: Level::Error,
}
}
@@ -696,7 +698,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_BASE = {
summary: "detects class bases that will cause the class definition to raise an exception at runtime",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -729,7 +731,7 @@ declare_lint! {
/// [method resolution order]: https://docs.python.org/3/glossary.html#term-method-resolution-order
pub(crate) static UNSUPPORTED_BASE = {
summary: "detects class bases that are unsupported as ty could not feasibly calculate the class's MRO",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.7"),
default_level: Level::Warn,
}
}
@@ -750,7 +752,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_CONTEXT_MANAGER = {
summary: "detects expressions used in with statements that don't implement the context manager protocol",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -773,7 +775,7 @@ declare_lint! {
/// [assignable to]: https://typing.python.org/en/latest/spec/glossary.html#term-assignable
pub(crate) static INVALID_DECLARATION = {
summary: "detects invalid declarations",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -809,7 +811,7 @@ declare_lint! {
/// This rule corresponds to Ruff's [`except-with-non-exception-classes` (`B030`)](https://docs.astral.sh/ruff/rules/except-with-non-exception-classes)
pub(crate) static INVALID_EXCEPTION_CAUGHT = {
summary: "detects exception handlers that catch classes that do not inherit from `BaseException`",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -835,7 +837,7 @@ declare_lint! {
/// - [Typing spec: Generics](https://typing.python.org/en/latest/spec/generics.html#introduction)
pub(crate) static INVALID_GENERIC_CLASS = {
summary: "detects invalid generic classes",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -863,7 +865,7 @@ declare_lint! {
/// - [Typing spec: Generics](https://typing.python.org/en/latest/spec/generics.html#introduction)
pub(crate) static INVALID_LEGACY_TYPE_VARIABLE = {
summary: "detects invalid legacy type variables",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -884,7 +886,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_TYPE_ALIAS_TYPE = {
summary: "detects invalid TypeAliasType definitions",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.6"),
default_level: Level::Error,
}
}
@@ -911,7 +913,7 @@ declare_lint! {
/// - [Python documentation: Metaclasses](https://docs.python.org/3/reference/datamodel.html#metaclasses)
pub(crate) static INVALID_METACLASS = {
summary: "detects invalid `metaclass=` arguments",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -954,7 +956,7 @@ declare_lint! {
/// - [Python documentation: `@overload`](https://docs.python.org/3/library/typing.html#typing.overload)
pub(crate) static INVALID_OVERLOAD = {
summary: "detects invalid `@overload` usages",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1010,7 +1012,7 @@ declare_lint! {
/// - [Python documentation: `@overload`](https://docs.python.org/3/library/typing.html#typing.overload)
pub(crate) static USELESS_OVERLOAD_BODY = {
summary: "detects `@overload`-decorated functions with non-stub bodies",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.22"),
default_level: Level::Warn,
}
}
@@ -1030,7 +1032,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_PARAMETER_DEFAULT = {
summary: "detects default values that can't be assigned to the parameter's annotated type",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1073,7 +1075,7 @@ declare_lint! {
/// - [Python documentation: Built-in Exceptions](https://docs.python.org/3/library/exceptions.html#built-in-exceptions)
pub(crate) static INVALID_RAISE = {
summary: "detects `raise` statements that raise invalid exceptions or use invalid causes",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1112,7 +1114,7 @@ declare_lint! {
/// - [Python documentation: super()](https://docs.python.org/3/library/functions.html#super)
pub(crate) static INVALID_SUPER_ARGUMENT = {
summary: "detects invalid arguments for `super()`",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1136,7 +1138,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_TYPE_CHECKING_CONSTANT = {
summary: "detects invalid `TYPE_CHECKING` constant assignments",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1160,7 +1162,7 @@ declare_lint! {
/// [type expressions]: https://typing.python.org/en/latest/spec/annotations.html#type-and-annotation-expressions
pub(crate) static INVALID_TYPE_FORM = {
summary: "detects invalid type forms",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1188,7 +1190,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_TYPE_GUARD_DEFINITION = {
summary: "detects malformed type guard functions",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.11"),
default_level: Level::Error,
}
}
@@ -1216,7 +1218,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_TYPE_GUARD_CALL = {
summary: "detects type guard function calls that has no narrowing effect",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.11"),
default_level: Level::Error,
}
}
@@ -1245,7 +1247,7 @@ declare_lint! {
/// [type variables]: https://docs.python.org/3/library/typing.html#typing.TypeVar
pub(crate) static INVALID_TYPE_VARIABLE_CONSTRAINTS = {
summary: "detects invalid type variable constraints",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1264,7 +1266,7 @@ declare_lint! {
/// ```
pub(crate) static MISSING_ARGUMENT = {
summary: "detects missing required arguments in a call",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1287,7 +1289,7 @@ declare_lint! {
/// ```
pub(crate) static NO_MATCHING_OVERLOAD = {
summary: "detects calls that do not match any overload",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1305,7 +1307,7 @@ declare_lint! {
/// ```
pub(crate) static NON_SUBSCRIPTABLE = {
summary: "detects subscripting objects that do not support subscripting",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1325,7 +1327,7 @@ declare_lint! {
/// ```
pub(crate) static NOT_ITERABLE = {
summary: "detects iteration over an object that is not iterable",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1356,7 +1358,7 @@ declare_lint! {
/// ```
pub(crate) static UNSUPPORTED_BOOL_CONVERSION = {
summary: "detects boolean conversion where the object incorrectly implements `__bool__`",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1377,7 +1379,7 @@ declare_lint! {
/// ```
pub(crate) static PARAMETER_ALREADY_ASSIGNED = {
summary: "detects multiple arguments for the same parameter",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1399,7 +1401,7 @@ declare_lint! {
/// ```
pub(crate) static POSSIBLY_MISSING_ATTRIBUTE = {
summary: "detects references to possibly missing attributes",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.22"),
default_level: Level::Warn,
}
}
@@ -1425,7 +1427,7 @@ declare_lint! {
/// ```
pub(crate) static POSSIBLY_MISSING_IMPORT = {
summary: "detects possibly missing imports",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.22"),
default_level: Level::Warn,
}
}
@@ -1447,7 +1449,7 @@ declare_lint! {
/// ```
pub(crate) static POSSIBLY_UNRESOLVED_REFERENCE = {
summary: "detects references to possibly undefined names",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Ignore,
}
}
@@ -1470,7 +1472,7 @@ declare_lint! {
/// ```
pub(crate) static SUBCLASS_OF_FINAL_CLASS = {
summary: "detects subclasses of final classes",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1492,7 +1494,7 @@ declare_lint! {
/// ```
pub(crate) static TYPE_ASSERTION_FAILURE = {
summary: "detects failed type assertions",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1513,7 +1515,7 @@ declare_lint! {
/// ```
pub(crate) static TOO_MANY_POSITIONAL_ARGUMENTS = {
summary: "detects calls passing too many positional arguments",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1552,7 +1554,7 @@ declare_lint! {
/// - [Python documentation: super()](https://docs.python.org/3/library/functions.html#super)
pub(crate) static UNAVAILABLE_IMPLICIT_SUPER_ARGUMENTS = {
summary: "detects invalid `super()` calls where implicit arguments are unavailable.",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1570,7 +1572,7 @@ declare_lint! {
/// ```
pub static UNDEFINED_REVEAL = {
summary: "detects usages of `reveal_type` without importing it",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Warn,
}
}
@@ -1591,7 +1593,7 @@ declare_lint! {
/// ```
pub(crate) static UNKNOWN_ARGUMENT = {
summary: "detects unknown keyword arguments in calls",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1612,7 +1614,7 @@ declare_lint! {
/// ```
pub(crate) static POSITIONAL_ONLY_PARAMETER_AS_KWARG = {
summary: "detects positional-only parameters passed as keyword arguments",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.22"),
default_level: Level::Error,
}
}
@@ -1634,7 +1636,7 @@ declare_lint! {
/// ```
pub(crate) static UNRESOLVED_ATTRIBUTE = {
summary: "detects references to unresolved attributes",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1653,7 +1655,7 @@ declare_lint! {
/// ```
pub(crate) static UNRESOLVED_IMPORT = {
summary: "detects unresolved imports",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1672,7 +1674,7 @@ declare_lint! {
/// ```
pub(crate) static UNRESOLVED_REFERENCE = {
summary: "detects references to names that are not defined",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1694,7 +1696,7 @@ declare_lint! {
/// ```
pub(crate) static UNSUPPORTED_OPERATOR = {
summary: "detects binary, unary, or comparison expressions where the operands don't support the operator",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1713,7 +1715,7 @@ declare_lint! {
/// ```
pub(crate) static ZERO_STEPSIZE_IN_SLICE = {
summary: "detects a slice step size of zero",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1737,7 +1739,7 @@ declare_lint! {
/// ```
pub(crate) static STATIC_ASSERT_ERROR = {
summary: "Failed static assertion",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1765,7 +1767,7 @@ declare_lint! {
/// ```
pub(crate) static INVALID_ATTRIBUTE_ACCESS = {
summary: "Invalid attribute access",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -1786,7 +1788,7 @@ declare_lint! {
/// ```
pub(crate) static REDUNDANT_CAST = {
summary: "detects redundant `cast` calls",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Warn,
}
}
@@ -1812,6 +1814,7 @@ declare_lint! {
/// ```
///
/// Use instead:
+ ///
/// ```python
/// x: int
///
@@ -1824,6 +1827,7 @@ declare_lint! {
/// ```
///
/// Or:
+ ///
/// ```python
/// x: int | None = None
///
@@ -1836,7 +1840,7 @@ declare_lint! {
/// ```
pub(crate) static UNRESOLVED_GLOBAL = {
summary: "detects `global` statements with no definition in the global scope",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.15"),
default_level: Level::Warn,
}
}
@@ -1863,7 +1867,7 @@ declare_lint! {
/// ```
pub(crate) static MISSING_TYPED_DICT_KEY = {
summary: "detects missing required keys in `TypedDict` constructors",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.20"),
default_level: Level::Error,
}
}
diff --git a/crates/ty_python_semantic/src/types/string_annotation.rs b/crates/ty_python_semantic/src/types/string_annotation.rs
index 69f312f36a..7ea673f3aa 100644
--- a/crates/ty_python_semantic/src/types/string_annotation.rs
+++ b/crates/ty_python_semantic/src/types/string_annotation.rs
@@ -28,7 +28,7 @@ declare_lint! {
/// ```
pub(crate) static FSTRING_TYPE_ANNOTATION = {
summary: "detects F-strings in type annotation positions",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -53,7 +53,7 @@ declare_lint! {
/// ```
pub(crate) static BYTE_STRING_TYPE_ANNOTATION = {
summary: "detects byte strings in type annotation positions",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -78,7 +78,7 @@ declare_lint! {
/// ```
pub(crate) static RAW_STRING_TYPE_ANNOTATION = {
summary: "detects raw strings in type annotation positions",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -103,7 +103,7 @@ declare_lint! {
/// ```
pub(crate) static IMPLICIT_CONCATENATED_STRING_TYPE_ANNOTATION = {
summary: "detects implicit concatenated strings in type annotations",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -112,7 +112,7 @@ declare_lint! {
/// TODO #14889
pub(crate) static INVALID_SYNTAX_IN_FORWARD_ANNOTATION = {
summary: "detects invalid syntax in forward annotations",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
@@ -121,7 +121,7 @@ declare_lint! {
/// TODO #14889
pub(crate) static ESCAPE_CHARACTER_IN_FORWARD_ANNOTATION = {
summary: "detects forward type annotations with escape characters",
- status: LintStatus::preview("1.0.0"),
+ status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Error,
}
}
diff --git a/ty.schema.json b/ty.schema.json
index 50d96233fb..5e3323b517 100644
--- a/ty.schema.json
+++ b/ty.schema.json
@@ -947,7 +947,7 @@
},
"unresolved-global": {
"title": "detects `global` statements with no definition in the global scope",
- "description": "## What it does\nDetects variables declared as `global` in an inner scope that have no explicit\nbindings or declarations in the global scope.\n\n## Why is this bad?\nFunction bodies with `global` statements can run in any order (or not at all), which makes\nit hard for static analysis tools to infer the types of globals without\nexplicit definitions or declarations.\n\n## Example\n```python\ndef f():\n global x # unresolved global\n x = 42\n\ndef g():\n print(x) # unresolved reference\n```\n\nUse instead:\n```python\nx: int\n\ndef f():\n global x\n x = 42\n\ndef g():\n print(x)\n```\n\nOr:\n```python\nx: int | None = None\n\ndef f():\n global x\n x = 42\n\ndef g():\n print(x)\n```",
+ "description": "## What it does\nDetects variables declared as `global` in an inner scope that have no explicit\nbindings or declarations in the global scope.\n\n## Why is this bad?\nFunction bodies with `global` statements can run in any order (or not at all), which makes\nit hard for static analysis tools to infer the types of globals without\nexplicit definitions or declarations.\n\n## Example\n```python\ndef f():\n global x # unresolved global\n x = 42\n\ndef g():\n print(x) # unresolved reference\n```\n\nUse instead:\n\n```python\nx: int\n\ndef f():\n global x\n x = 42\n\ndef g():\n print(x)\n```\n\nOr:\n\n```python\nx: int | None = None\n\ndef f():\n global x\n x = 42\n\ndef g():\n print(x)\n```",
"default": "warn",
"oneOf": [
{