mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
ty: get rid of lint:
prefix in ID for diagnostic rendering
In #289, we seem to have consensus that this prefix isn't really pulling its weight. Ref #289
This commit is contained in:
parent
d1bb10a66b
commit
2c4cbb6e29
89 changed files with 271 additions and 257 deletions
|
@ -649,6 +649,20 @@ impl DiagnosticId {
|
|||
})
|
||||
}
|
||||
|
||||
/// Returns a "concise" description of this diagnostic ID.
|
||||
///
|
||||
/// Specifically, this avoids adding a `lint:` prefix (or other
|
||||
/// possible category prefixes, although `lint` is the only one
|
||||
/// as of 2025-05-09) to the diagnostic ID when this is a lint
|
||||
/// identifier. This is useful in diagnostic rendering where we
|
||||
/// want to elide this prefix.
|
||||
fn as_concise_str(&self) -> &str {
|
||||
match self.as_str() {
|
||||
Ok(name) => name,
|
||||
Err(DiagnosticAsStrError::Category { name, .. }) => name,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_invalid_syntax(&self) -> bool {
|
||||
matches!(self, Self::InvalidSyntax)
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ impl std::fmt::Display for DisplayDiagnostic<'_> {
|
|||
f,
|
||||
"{severity}[{id}]",
|
||||
severity = fmt_styled(severity, severity_style),
|
||||
id = fmt_styled(self.diag.id(), stylesheet.emphasis)
|
||||
id = fmt_styled(self.diag.id().as_concise_str(), stylesheet.emphasis)
|
||||
)?;
|
||||
|
||||
if let Some(span) = self.diag.primary_span() {
|
||||
|
@ -152,7 +152,7 @@ impl<'a> Resolved<'a> {
|
|||
for sub in &diag.inner.subs {
|
||||
diagnostics.push(ResolvedDiagnostic::from_sub_diagnostic(resolver, sub));
|
||||
}
|
||||
let id = diag.inner.id.to_string();
|
||||
let id = diag.inner.id.as_concise_str().to_string();
|
||||
Resolved { id, diagnostics }
|
||||
}
|
||||
|
||||
|
@ -198,14 +198,14 @@ impl<'a> ResolvedDiagnostic<'a> {
|
|||
})
|
||||
.collect();
|
||||
let message = if diag.inner.message.as_str().is_empty() {
|
||||
diag.inner.id.to_string()
|
||||
diag.inner.id.as_concise_str().to_string()
|
||||
} else {
|
||||
// TODO: See the comment on `Renderable::id` for
|
||||
// a plausible better idea than smushing the ID
|
||||
// into the diagnostic message.
|
||||
format!(
|
||||
"{id}: {message}",
|
||||
id = diag.inner.id,
|
||||
id = diag.inner.id.as_concise_str(),
|
||||
message = diag.inner.message.as_str(),
|
||||
)
|
||||
};
|
||||
|
@ -799,7 +799,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
3 | canary
|
||||
|
@ -823,7 +823,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
warning: lint:test-diagnostic: main diagnostic message
|
||||
warning: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
3 | canary
|
||||
|
@ -843,7 +843,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
info: lint:test-diagnostic: main diagnostic message
|
||||
info: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
3 | canary
|
||||
|
@ -870,7 +870,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -889,7 +889,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -910,7 +910,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> non-ascii:5:1
|
||||
|
|
||||
3 | ΔΔΔΔΔΔΔΔΔΔΔΔ
|
||||
|
@ -929,7 +929,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> non-ascii:2:2
|
||||
|
|
||||
1 | ☃☃☃☃☃☃☃☃☃☃☃☃
|
||||
|
@ -953,7 +953,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
4 | dog
|
||||
|
@ -970,7 +970,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
5 | elephant
|
||||
|
@ -985,7 +985,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1002,7 +1002,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:11:1
|
||||
|
|
||||
9 | inchworm
|
||||
|
@ -1019,7 +1019,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1052,7 +1052,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1096,7 +1096,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1121,7 +1121,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1149,7 +1149,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1177,7 +1177,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1202,7 +1202,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1233,7 +1233,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:1:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1271,7 +1271,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> spacey-animals:8:1
|
||||
|
|
||||
7 | dog
|
||||
|
@ -1288,7 +1288,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> spacey-animals:12:1
|
||||
|
|
||||
11 | gorilla
|
||||
|
@ -1306,7 +1306,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> spacey-animals:13:1
|
||||
|
|
||||
11 | gorilla
|
||||
|
@ -1346,7 +1346,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> spacey-animals:3:1
|
||||
|
|
||||
3 | beetle
|
||||
|
@ -1375,7 +1375,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:3:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1412,7 +1412,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:3:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1449,7 +1449,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:3:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1477,7 +1477,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:3:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1513,7 +1513,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:3:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1552,7 +1552,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:3:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1600,7 +1600,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:3:1
|
||||
|
|
||||
1 | aardvark
|
||||
|
@ -1636,7 +1636,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1659,7 +1659,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1679,7 +1679,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1699,7 +1699,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:4
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1721,7 +1721,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:4
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1753,7 +1753,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:4:1
|
||||
|
|
||||
2 | beetle
|
||||
|
@ -1782,7 +1782,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:4:1
|
||||
|
|
||||
2 | beetle
|
||||
|
@ -1813,7 +1813,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1848,7 +1848,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1876,7 +1876,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1908,7 +1908,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:3
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1930,7 +1930,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:3
|
||||
|
|
||||
3 | canary
|
||||
|
@ -1963,7 +1963,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:8:1
|
||||
|
|
||||
6 | finch
|
||||
|
@ -2003,7 +2003,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:5:1
|
||||
|
|
||||
5 | elephant
|
||||
|
@ -2047,7 +2047,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> fruits:1:1
|
||||
|
|
||||
1 | apple
|
||||
|
@ -2082,7 +2082,7 @@ watermelon
|
|||
insta::assert_snapshot!(
|
||||
env.render(&diag),
|
||||
@r"
|
||||
error: lint:test-diagnostic: main diagnostic message
|
||||
error: test-diagnostic: main diagnostic message
|
||||
--> animals:11:1
|
||||
|
|
||||
11 | kangaroo
|
||||
|
|
|
@ -144,7 +144,7 @@ fn config_override_python_version() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
error: lint:unresolved-attribute: Type `<module 'sys'>` has no attribute `last_exc`
|
||||
error: unresolved-attribute: Type `<module 'sys'>` has no attribute `last_exc`
|
||||
--> test.py:5:7
|
||||
|
|
||||
4 | # Access `sys.last_exc` that was only added in Python 3.12
|
||||
|
@ -278,7 +278,7 @@ fn cli_arguments_are_relative_to_the_current_directory() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
error: lint:unresolved-import: Cannot resolve imported module `utils`
|
||||
error: unresolved-import: Cannot resolve imported module `utils`
|
||||
--> test.py:2:6
|
||||
|
|
||||
2 | from utils import add
|
||||
|
@ -379,7 +379,7 @@ fn configuration_rule_severity() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
error: lint:division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
error: division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
--> test.py:2:5
|
||||
|
|
||||
2 | y = 4 / 0
|
||||
|
@ -389,7 +389,7 @@ fn configuration_rule_severity() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:division-by-zero` is enabled by default
|
||||
|
||||
error: lint:unresolved-reference: Name `prin` used when not defined
|
||||
error: unresolved-reference: Name `prin` used when not defined
|
||||
--> test.py:7:1
|
||||
|
|
||||
5 | x = a
|
||||
|
@ -417,7 +417,7 @@ fn configuration_rule_severity() -> anyhow::Result<()> {
|
|||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
warning: lint:division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
warning: division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
--> test.py:2:5
|
||||
|
|
||||
2 | y = 4 / 0
|
||||
|
@ -458,7 +458,7 @@ fn cli_rule_severity() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
error: lint:unresolved-import: Cannot resolve imported module `does_not_exit`
|
||||
error: unresolved-import: Cannot resolve imported module `does_not_exit`
|
||||
--> test.py:2:8
|
||||
|
|
||||
2 | import does_not_exit
|
||||
|
@ -468,7 +468,7 @@ fn cli_rule_severity() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:unresolved-import` is enabled by default
|
||||
|
||||
error: lint:division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
error: division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
--> test.py:4:5
|
||||
|
|
||||
2 | import does_not_exit
|
||||
|
@ -480,7 +480,7 @@ fn cli_rule_severity() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:division-by-zero` is enabled by default
|
||||
|
||||
error: lint:unresolved-reference: Name `prin` used when not defined
|
||||
error: unresolved-reference: Name `prin` used when not defined
|
||||
--> test.py:9:1
|
||||
|
|
||||
7 | x = a
|
||||
|
@ -508,7 +508,7 @@ fn cli_rule_severity() -> anyhow::Result<()> {
|
|||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-import: Cannot resolve imported module `does_not_exit`
|
||||
warning: unresolved-import: Cannot resolve imported module `does_not_exit`
|
||||
--> test.py:2:8
|
||||
|
|
||||
2 | import does_not_exit
|
||||
|
@ -518,7 +518,7 @@ fn cli_rule_severity() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:unresolved-import` was selected on the command line
|
||||
|
||||
warning: lint:division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
warning: division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
--> test.py:4:5
|
||||
|
|
||||
2 | import does_not_exit
|
||||
|
@ -561,7 +561,7 @@ fn cli_rule_severity_precedence() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
error: lint:division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
error: division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
--> test.py:2:5
|
||||
|
|
||||
2 | y = 4 / 0
|
||||
|
@ -571,7 +571,7 @@ fn cli_rule_severity_precedence() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:division-by-zero` is enabled by default
|
||||
|
||||
error: lint:unresolved-reference: Name `prin` used when not defined
|
||||
error: unresolved-reference: Name `prin` used when not defined
|
||||
--> test.py:7:1
|
||||
|
|
||||
5 | x = a
|
||||
|
@ -600,7 +600,7 @@ fn cli_rule_severity_precedence() -> anyhow::Result<()> {
|
|||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
warning: lint:division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
warning: division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
--> test.py:2:5
|
||||
|
|
||||
2 | y = 4 / 0
|
||||
|
@ -680,7 +680,7 @@ fn exit_code_only_warnings() -> anyhow::Result<()> {
|
|||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-reference: Name `x` used when not defined
|
||||
warning: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:1:7
|
||||
|
|
||||
1 | print(x) # [unresolved-reference]
|
||||
|
@ -764,7 +764,7 @@ fn exit_code_no_errors_but_error_on_warning_is_true() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-reference: Name `x` used when not defined
|
||||
warning: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:1:7
|
||||
|
|
||||
1 | print(x) # [unresolved-reference]
|
||||
|
@ -797,7 +797,7 @@ fn exit_code_no_errors_but_error_on_warning_is_enabled_in_configuration() -> any
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-reference: Name `x` used when not defined
|
||||
warning: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:1:7
|
||||
|
|
||||
1 | print(x) # [unresolved-reference]
|
||||
|
@ -827,7 +827,7 @@ fn exit_code_both_warnings_and_errors() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-reference: Name `x` used when not defined
|
||||
warning: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:2:7
|
||||
|
|
||||
2 | print(x) # [unresolved-reference]
|
||||
|
@ -836,7 +836,7 @@ fn exit_code_both_warnings_and_errors() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:unresolved-reference` was selected on the command line
|
||||
|
||||
error: lint:non-subscriptable: Cannot subscript object of type `Literal[4]` with no `__getitem__` method
|
||||
error: non-subscriptable: Cannot subscript object of type `Literal[4]` with no `__getitem__` method
|
||||
--> test.py:3:7
|
||||
|
|
||||
2 | print(x) # [unresolved-reference]
|
||||
|
@ -867,7 +867,7 @@ fn exit_code_both_warnings_and_errors_and_error_on_warning_is_true() -> anyhow::
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-reference: Name `x` used when not defined
|
||||
warning: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:2:7
|
||||
|
|
||||
2 | print(x) # [unresolved-reference]
|
||||
|
@ -876,7 +876,7 @@ fn exit_code_both_warnings_and_errors_and_error_on_warning_is_true() -> anyhow::
|
|||
|
|
||||
info: `lint:unresolved-reference` was selected on the command line
|
||||
|
||||
error: lint:non-subscriptable: Cannot subscript object of type `Literal[4]` with no `__getitem__` method
|
||||
error: non-subscriptable: Cannot subscript object of type `Literal[4]` with no `__getitem__` method
|
||||
--> test.py:3:7
|
||||
|
|
||||
2 | print(x) # [unresolved-reference]
|
||||
|
@ -907,7 +907,7 @@ fn exit_code_exit_zero_is_true() -> anyhow::Result<()> {
|
|||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-reference: Name `x` used when not defined
|
||||
warning: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:2:7
|
||||
|
|
||||
2 | print(x) # [unresolved-reference]
|
||||
|
@ -916,7 +916,7 @@ fn exit_code_exit_zero_is_true() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:unresolved-reference` was selected on the command line
|
||||
|
||||
error: lint:non-subscriptable: Cannot subscript object of type `Literal[4]` with no `__getitem__` method
|
||||
error: non-subscriptable: Cannot subscript object of type `Literal[4]` with no `__getitem__` method
|
||||
--> test.py:3:7
|
||||
|
|
||||
2 | print(x) # [unresolved-reference]
|
||||
|
@ -969,7 +969,7 @@ fn user_configuration() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
warning: lint:division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
warning: division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
--> main.py:2:5
|
||||
|
|
||||
2 | y = 4 / 0
|
||||
|
@ -979,7 +979,7 @@ fn user_configuration() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:division-by-zero` was selected in the configuration file
|
||||
|
||||
error: lint:unresolved-reference: Name `prin` used when not defined
|
||||
error: unresolved-reference: Name `prin` used when not defined
|
||||
--> main.py:7:1
|
||||
|
|
||||
5 | x = a
|
||||
|
@ -1013,7 +1013,7 @@ fn user_configuration() -> anyhow::Result<()> {
|
|||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
warning: lint:division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
warning: division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
--> main.py:2:5
|
||||
|
|
||||
2 | y = 4 / 0
|
||||
|
@ -1023,7 +1023,7 @@ fn user_configuration() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:division-by-zero` was selected in the configuration file
|
||||
|
||||
warning: lint:unresolved-reference: Name `prin` used when not defined
|
||||
warning: unresolved-reference: Name `prin` used when not defined
|
||||
--> main.py:7:1
|
||||
|
|
||||
5 | x = a
|
||||
|
@ -1073,7 +1073,7 @@ fn check_specific_paths() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
error: lint:division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
error: division-by-zero: Cannot divide object of type `Literal[4]` by zero
|
||||
--> project/main.py:2:5
|
||||
|
|
||||
2 | y = 4 / 0 # error: division-by-zero
|
||||
|
@ -1081,7 +1081,7 @@ fn check_specific_paths() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:division-by-zero` is enabled by default
|
||||
|
||||
error: lint:unresolved-import: Cannot resolve imported module `main2`
|
||||
error: unresolved-import: Cannot resolve imported module `main2`
|
||||
--> project/other.py:2:6
|
||||
|
|
||||
2 | from main2 import z # error: unresolved-import
|
||||
|
@ -1091,7 +1091,7 @@ fn check_specific_paths() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:unresolved-import` is enabled by default
|
||||
|
||||
error: lint:unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
error: unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
--> project/tests/test_main.py:2:8
|
||||
|
|
||||
2 | import does_not_exist # error: unresolved-import
|
||||
|
@ -1113,7 +1113,7 @@ fn check_specific_paths() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
error: lint:unresolved-import: Cannot resolve imported module `main2`
|
||||
error: unresolved-import: Cannot resolve imported module `main2`
|
||||
--> project/other.py:2:6
|
||||
|
|
||||
2 | from main2 import z # error: unresolved-import
|
||||
|
@ -1123,7 +1123,7 @@ fn check_specific_paths() -> anyhow::Result<()> {
|
|||
|
|
||||
info: `lint:unresolved-import` is enabled by default
|
||||
|
||||
error: lint:unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
error: unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
--> project/tests/test_main.py:2:8
|
||||
|
|
||||
2 | import does_not_exist # error: unresolved-import
|
||||
|
@ -1185,8 +1185,8 @@ fn concise_diagnostics() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
warning[lint:unresolved-reference] test.py:2:7: Name `x` used when not defined
|
||||
error[lint:non-subscriptable] test.py:3:7: Cannot subscript object of type `Literal[4]` with no `__getitem__` method
|
||||
warning[unresolved-reference] test.py:2:7: Name `x` used when not defined
|
||||
error[non-subscriptable] test.py:3:7: Cannot subscript object of type `Literal[4]` with no `__getitem__` method
|
||||
Found 2 diagnostics
|
||||
|
||||
----- stderr -----
|
||||
|
@ -1292,7 +1292,7 @@ fn defaults_to_a_new_python_version() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
error: lint:unresolved-attribute: Type `<module 'os'>` has no attribute `grantpt`
|
||||
error: unresolved-attribute: Type `<module 'os'>` has no attribute `grantpt`
|
||||
--> main.py:4:1
|
||||
|
|
||||
2 | import os
|
||||
|
@ -1347,7 +1347,7 @@ fn cli_config_args_toml_string_basic() -> anyhow::Result<()> {
|
|||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-reference: Name `x` used when not defined
|
||||
warning: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:1:7
|
||||
|
|
||||
1 | print(x) # [unresolved-reference]
|
||||
|
@ -1358,14 +1358,14 @@ fn cli_config_args_toml_string_basic() -> anyhow::Result<()> {
|
|||
Found 1 diagnostic
|
||||
|
||||
----- stderr -----
|
||||
");
|
||||
");
|
||||
|
||||
// Short flag
|
||||
assert_cmd_snapshot!(case.command().arg("-c").arg("terminal.error-on-warning=true"), @r"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
error: lint:unresolved-reference: Name `x` used when not defined
|
||||
error: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:1:7
|
||||
|
|
||||
1 | print(x) # [unresolved-reference]
|
||||
|
@ -1376,7 +1376,7 @@ fn cli_config_args_toml_string_basic() -> anyhow::Result<()> {
|
|||
Found 1 diagnostic
|
||||
|
||||
----- stderr -----
|
||||
");
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1397,7 +1397,7 @@ fn cli_config_args_overrides_knot_toml() -> anyhow::Result<()> {
|
|||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-reference: Name `x` used when not defined
|
||||
warning: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:1:7
|
||||
|
|
||||
1 | print(x) # [unresolved-reference]
|
||||
|
@ -1420,7 +1420,7 @@ fn cli_config_args_later_overrides_earlier() -> anyhow::Result<()> {
|
|||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
warning: lint:unresolved-reference: Name `x` used when not defined
|
||||
warning: unresolved-reference: Name `x` used when not defined
|
||||
--> test.py:1:7
|
||||
|
|
||||
1 | print(x) # [unresolved-reference]
|
||||
|
|
|
@ -273,7 +273,7 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> main.py:2:19
|
||||
|
|
||||
2 | class Test: ...
|
||||
|
@ -305,7 +305,7 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> main.py:2:17
|
||||
|
|
||||
2 | def foo(a, b): ...
|
||||
|
@ -343,7 +343,7 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> main.py:3:17
|
||||
|
|
||||
3 | def foo(a, b): ...
|
||||
|
@ -360,7 +360,7 @@ mod tests {
|
|||
| ^
|
||||
|
|
||||
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> main.py:5:17
|
||||
|
|
||||
3 | def foo(a, b): ...
|
||||
|
@ -394,7 +394,7 @@ mod tests {
|
|||
test.write_file("lib.py", "a = 10").unwrap();
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> lib.py:1:1
|
||||
|
|
||||
1 | a = 10
|
||||
|
@ -422,7 +422,7 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> stdlib/builtins.pyi:438:7
|
||||
|
|
||||
436 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
|
@ -451,7 +451,7 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> stdlib/builtins.pyi:438:7
|
||||
|
|
||||
436 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
|
@ -479,7 +479,7 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> main.py:2:24
|
||||
|
|
||||
2 | type Alias[T: int = bool] = list[T]
|
||||
|
@ -533,7 +533,7 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> stdlib/builtins.pyi:438:7
|
||||
|
|
||||
436 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
|
@ -568,7 +568,7 @@ mod tests {
|
|||
// the keyword is typed as a string. It's only the passed argument that
|
||||
// is an int. Navigating to `str` would match pyright's behavior.
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> stdlib/builtins.pyi:231:7
|
||||
|
|
||||
229 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
|
||||
|
@ -602,7 +602,7 @@ f(**kwargs<CURSOR>)
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> stdlib/builtins.pyi:1086:7
|
||||
|
|
||||
1084 | def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
@ -633,7 +633,7 @@ f(**kwargs<CURSOR>)
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> stdlib/builtins.pyi:438:7
|
||||
|
|
||||
436 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
|
@ -667,7 +667,7 @@ f(**kwargs<CURSOR>)
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> main.py:2:19
|
||||
|
|
||||
2 | class X:
|
||||
|
@ -696,7 +696,7 @@ f(**kwargs<CURSOR>)
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> main.py:2:17
|
||||
|
|
||||
2 | def foo(a, b): ...
|
||||
|
@ -726,7 +726,7 @@ f(**kwargs<CURSOR>)
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> stdlib/builtins.pyi:438:7
|
||||
|
|
||||
436 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
|
@ -757,7 +757,7 @@ f(**kwargs<CURSOR>)
|
|||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> stdlib/types.pyi:671:11
|
||||
|
|
||||
669 | if sys.version_info >= (3, 10):
|
||||
|
@ -774,7 +774,7 @@ f(**kwargs<CURSOR>)
|
|||
| ^
|
||||
|
|
||||
|
||||
info: lint:goto-type-definition: Type definition
|
||||
info: goto-type-definition: Type definition
|
||||
--> stdlib/builtins.pyi:438:7
|
||||
|
|
||||
436 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
|
|
|
@ -156,7 +156,7 @@ mod tests {
|
|||
Literal[10]
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:4:9
|
||||
|
|
||||
2 | a = 10
|
||||
|
@ -192,7 +192,7 @@ mod tests {
|
|||
int
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:10:9
|
||||
|
|
||||
9 | foo = Foo()
|
||||
|
@ -222,7 +222,7 @@ mod tests {
|
|||
def foo(a, b) -> Unknown
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:4:13
|
||||
|
|
||||
2 | def foo(a, b): ...
|
||||
|
@ -251,7 +251,7 @@ mod tests {
|
|||
bool
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:3:17
|
||||
|
|
||||
2 | def foo(a: int, b: int, c: int):
|
||||
|
@ -282,7 +282,7 @@ mod tests {
|
|||
Literal[123]
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:4:18
|
||||
|
|
||||
2 | def test(a: int): ...
|
||||
|
@ -320,7 +320,7 @@ mod tests {
|
|||
(def foo(a, b) -> Unknown) | (def bar(a, b) -> Unknown)
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:12:13
|
||||
|
|
||||
10 | a = bar
|
||||
|
@ -352,7 +352,7 @@ mod tests {
|
|||
<module 'lib'>
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:4:13
|
||||
|
|
||||
2 | import lib
|
||||
|
@ -381,7 +381,7 @@ mod tests {
|
|||
T
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:2:46
|
||||
|
|
||||
2 | type Alias[T: int = bool] = list[T]
|
||||
|
@ -407,7 +407,7 @@ mod tests {
|
|||
@Todo
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:2:53
|
||||
|
|
||||
2 | type Alias[**P = [int, str]] = Callable[P, int]
|
||||
|
@ -433,7 +433,7 @@ mod tests {
|
|||
@Todo
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:2:43
|
||||
|
|
||||
2 | type Alias[*Ts = ()] = tuple[*Ts]
|
||||
|
@ -459,7 +459,7 @@ mod tests {
|
|||
Literal[1]
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:2:13
|
||||
|
|
||||
2 | value = 1
|
||||
|
@ -490,7 +490,7 @@ mod tests {
|
|||
Literal[1]
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:3:13
|
||||
|
|
||||
2 | value = 1
|
||||
|
@ -520,7 +520,7 @@ mod tests {
|
|||
Literal[2]
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:5:13
|
||||
|
|
||||
3 | attr: int = 1
|
||||
|
@ -553,7 +553,7 @@ mod tests {
|
|||
Unknown | Literal[1]
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:5:13
|
||||
|
|
||||
3 | attr = 1
|
||||
|
@ -582,7 +582,7 @@ mod tests {
|
|||
int
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:3:13
|
||||
|
|
||||
2 | class Foo:
|
||||
|
@ -610,7 +610,7 @@ mod tests {
|
|||
Literal[1]
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:3:13
|
||||
|
|
||||
2 | class Foo:
|
||||
|
@ -639,7 +639,7 @@ mod tests {
|
|||
int
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:4:17
|
||||
|
|
||||
2 | class Foo:
|
||||
|
@ -669,7 +669,7 @@ mod tests {
|
|||
str
|
||||
```
|
||||
---------------------------------------------
|
||||
info: lint:hover: Hovered content is
|
||||
info: hover: Hovered content is
|
||||
--> main.py:4:27
|
||||
|
|
||||
2 | def foo(a: str | None, b):
|
||||
|
|
|
@ -28,7 +28,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/attribute_as
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Invalid assignment to data descriptor attribute `attr` on type `C` with custom `__set__` method
|
||||
error: invalid-assignment: Invalid assignment to data descriptor attribute `attr` on type `C` with custom `__set__` method
|
||||
--> src/mdtest_snippet.py:11:1
|
||||
|
|
||||
10 | # TODO: ideally, we would mention why this is an invalid assignment (wrong number of arguments for `__set__`)
|
||||
|
|
|
@ -29,7 +29,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/attribute_as
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Invalid assignment to data descriptor attribute `attr` on type `C` with custom `__set__` method
|
||||
error: invalid-assignment: Invalid assignment to data descriptor attribute `attr` on type `C` with custom `__set__` method
|
||||
--> src/mdtest_snippet.py:12:1
|
||||
|
|
||||
11 | # TODO: ideally, we would mention why this is an invalid assignment (wrong argument type for `value` parameter)
|
||||
|
|
|
@ -26,7 +26,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/attribute_as
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Object of type `Literal["wrong"]` is not assignable to attribute `attr` of type `int`
|
||||
error: invalid-assignment: Object of type `Literal["wrong"]` is not assignable to attribute `attr` of type `int`
|
||||
--> src/mdtest_snippet.py:6:1
|
||||
|
|
||||
4 | instance = C()
|
||||
|
@ -41,7 +41,7 @@ info: `lint:invalid-assignment` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Object of type `Literal["wrong"]` is not assignable to attribute `attr` of type `int`
|
||||
error: invalid-assignment: Object of type `Literal["wrong"]` is not assignable to attribute `attr` of type `int`
|
||||
--> src/mdtest_snippet.py:9:1
|
||||
|
|
||||
8 | C.attr = 1 # fine
|
||||
|
|
|
@ -26,7 +26,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/attribute_as
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
warning: lint:possibly-unbound-attribute: Attribute `attr` on type `<class 'C'>` is possibly unbound
|
||||
warning: possibly-unbound-attribute: Attribute `attr` on type `<class 'C'>` is possibly unbound
|
||||
--> src/mdtest_snippet.py:6:5
|
||||
|
|
||||
4 | attr: int = 0
|
||||
|
@ -41,7 +41,7 @@ info: `lint:possibly-unbound-attribute` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
warning: lint:possibly-unbound-attribute: Attribute `attr` on type `C` is possibly unbound
|
||||
warning: possibly-unbound-attribute: Attribute `attr` on type `C` is possibly unbound
|
||||
--> src/mdtest_snippet.py:9:5
|
||||
|
|
||||
8 | instance = C()
|
||||
|
|
|
@ -26,7 +26,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/attribute_as
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Object of type `Literal["wrong"]` is not assignable to attribute `attr` of type `int`
|
||||
error: invalid-assignment: Object of type `Literal["wrong"]` is not assignable to attribute `attr` of type `int`
|
||||
--> src/mdtest_snippet.py:7:1
|
||||
|
|
||||
5 | instance = C()
|
||||
|
@ -41,7 +41,7 @@ info: `lint:invalid-assignment` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-attribute-access: Cannot assign to instance attribute `attr` from the class object `<class 'C'>`
|
||||
error: invalid-attribute-access: Cannot assign to instance attribute `attr` from the class object `<class 'C'>`
|
||||
--> src/mdtest_snippet.py:9:1
|
||||
|
|
||||
7 | instance.attr = "wrong" # error: [invalid-assignment]
|
||||
|
|
|
@ -37,7 +37,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/attribute_as
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Object of type `Literal[1]` is not assignable to attribute `attr` on type `<class 'C1'> | <class 'C1'>`
|
||||
error: invalid-assignment: Object of type `Literal[1]` is not assignable to attribute `attr` on type `<class 'C1'> | <class 'C1'>`
|
||||
--> src/mdtest_snippet.py:11:5
|
||||
|
|
||||
10 | # TODO: The error message here could be improved to explain why the assignment fails.
|
||||
|
|
|
@ -23,7 +23,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/attribute_as
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-attribute: Unresolved attribute `non_existent` on type `<class 'C'>`.
|
||||
error: unresolved-attribute: Unresolved attribute `non_existent` on type `<class 'C'>`.
|
||||
--> src/mdtest_snippet.py:3:1
|
||||
|
|
||||
1 | class C: ...
|
||||
|
@ -38,7 +38,7 @@ info: `lint:unresolved-attribute` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:unresolved-attribute: Unresolved attribute `non_existent` on type `C`.
|
||||
error: unresolved-attribute: Unresolved attribute `non_existent` on type `C`.
|
||||
--> src/mdtest_snippet.py:6:1
|
||||
|
|
||||
5 | instance = C()
|
||||
|
|
|
@ -27,7 +27,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/attribute_as
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Object of type `Literal["wrong"]` is not assignable to attribute `attr` of type `int`
|
||||
error: invalid-assignment: Object of type `Literal["wrong"]` is not assignable to attribute `attr` of type `int`
|
||||
--> src/mdtest_snippet.py:7:1
|
||||
|
|
||||
6 | C.attr = 1 # fine
|
||||
|
@ -41,7 +41,7 @@ info: `lint:invalid-assignment` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-attribute-access: Cannot assign to ClassVar `attr` from an instance of type `C`
|
||||
error: invalid-attribute-access: Cannot assign to ClassVar `attr` from an instance of type `C`
|
||||
--> src/mdtest_snippet.py:10:1
|
||||
|
|
||||
9 | instance = C()
|
||||
|
|
|
@ -19,7 +19,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/import/basic.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
error: unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
--> src/mdtest_snippet.py:2:6
|
||||
|
|
||||
1 | # error: [unresolved-import]
|
||||
|
|
|
@ -18,7 +18,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/import/basic.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Cannot resolve imported module `zqzqzqzqzqzqzq`
|
||||
error: unresolved-import: Cannot resolve imported module `zqzqzqzqzqzqzq`
|
||||
--> src/mdtest_snippet.py:1:8
|
||||
|
|
||||
1 | import zqzqzqzqzqzqzq # error: [unresolved-import] "Cannot resolve imported module `zqzqzqzqzqzqzq`"
|
||||
|
|
|
@ -27,7 +27,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/import/basic.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Cannot resolve imported module `a.foo`
|
||||
error: unresolved-import: Cannot resolve imported module `a.foo`
|
||||
--> src/mdtest_snippet.py:2:8
|
||||
|
|
||||
1 | # Topmost component resolvable, submodule not resolvable:
|
||||
|
@ -41,7 +41,7 @@ info: `lint:unresolved-import` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Cannot resolve imported module `b.foo`
|
||||
error: unresolved-import: Cannot resolve imported module `b.foo`
|
||||
--> src/mdtest_snippet.py:5:8
|
||||
|
|
||||
4 | # Topmost component unresolvable:
|
||||
|
|
|
@ -28,7 +28,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable` is not iterable
|
||||
error: not-iterable: Object of type `Iterable` is not iterable
|
||||
--> src/mdtest_snippet.py:10:10
|
||||
|
|
||||
9 | # error: [not-iterable]
|
||||
|
|
|
@ -20,7 +20,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Literal[123]` is not iterable
|
||||
error: not-iterable: Object of type `Literal[123]` is not iterable
|
||||
--> src/mdtest_snippet.py:2:10
|
||||
|
|
||||
1 | nonsense = 123
|
||||
|
|
|
@ -24,7 +24,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `NotIterable` is not iterable
|
||||
error: not-iterable: Object of type `NotIterable` is not iterable
|
||||
--> src/mdtest_snippet.py:6:10
|
||||
|
|
||||
4 | __iter__: None = None
|
||||
|
|
|
@ -25,7 +25,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Bad` is not iterable
|
||||
error: not-iterable: Object of type `Bad` is not iterable
|
||||
--> src/mdtest_snippet.py:7:10
|
||||
|
|
||||
6 | # error: [not-iterable]
|
||||
|
|
|
@ -46,7 +46,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable1` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable1` may not be iterable
|
||||
--> src/mdtest_snippet.py:22:14
|
||||
|
|
||||
21 | # error: [not-iterable]
|
||||
|
@ -76,7 +76,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable2` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable2` may not be iterable
|
||||
--> src/mdtest_snippet.py:27:14
|
||||
|
|
||||
26 | # error: [not-iterable]
|
||||
|
|
|
@ -43,7 +43,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable1` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable1` may not be iterable
|
||||
--> src/mdtest_snippet.py:20:14
|
||||
|
|
||||
19 | # error: [not-iterable]
|
||||
|
@ -73,7 +73,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable2` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable2` may not be iterable
|
||||
--> src/mdtest_snippet.py:25:14
|
||||
|
|
||||
24 | # error: [not-iterable]
|
||||
|
|
|
@ -47,7 +47,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable1` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable1` may not be iterable
|
||||
--> src/mdtest_snippet.py:17:14
|
||||
|
|
||||
16 | # error: [not-iterable]
|
||||
|
@ -77,7 +77,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable2` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable2` may not be iterable
|
||||
--> src/mdtest_snippet.py:28:14
|
||||
|
|
||||
27 | # error: [not-iterable]
|
||||
|
|
|
@ -51,7 +51,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable1` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable1` may not be iterable
|
||||
--> src/mdtest_snippet.py:28:14
|
||||
|
|
||||
27 | # error: [not-iterable]
|
||||
|
@ -80,7 +80,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable2` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable2` may not be iterable
|
||||
--> src/mdtest_snippet.py:32:14
|
||||
|
|
||||
31 | # error: [not-iterable]
|
||||
|
|
|
@ -36,7 +36,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable` may not be iterable
|
||||
--> src/mdtest_snippet.py:18:14
|
||||
|
|
||||
17 | # error: [not-iterable]
|
||||
|
|
|
@ -54,7 +54,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable1` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable1` may not be iterable
|
||||
--> src/mdtest_snippet.py:31:14
|
||||
|
|
||||
30 | # error: [not-iterable]
|
||||
|
@ -83,7 +83,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable2` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable2` may not be iterable
|
||||
--> src/mdtest_snippet.py:36:14
|
||||
|
|
||||
35 | # error: [not-iterable]
|
||||
|
|
|
@ -35,7 +35,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable` may not be iterable
|
||||
error: not-iterable: Object of type `Iterable` may not be iterable
|
||||
--> src/mdtest_snippet.py:17:14
|
||||
|
|
||||
16 | # error: [not-iterable]
|
||||
|
|
|
@ -36,7 +36,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Test | Test2` may not be iterable
|
||||
error: not-iterable: Object of type `Test | Test2` may not be iterable
|
||||
--> src/mdtest_snippet.py:18:14
|
||||
|
|
||||
16 | # TODO: Improve error message to state which union variant isn't iterable (https://github.com/astral-sh/ruff/issues/13989)
|
||||
|
|
|
@ -31,7 +31,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Test | Literal[42]` may not be iterable
|
||||
error: not-iterable: Object of type `Test | Literal[42]` may not be iterable
|
||||
--> src/mdtest_snippet.py:13:14
|
||||
|
|
||||
11 | def _(flag: bool):
|
||||
|
|
|
@ -33,7 +33,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `NotIterable` is not iterable
|
||||
error: not-iterable: Object of type `NotIterable` is not iterable
|
||||
--> src/mdtest_snippet.py:11:14
|
||||
|
|
||||
10 | # error: [not-iterable]
|
||||
|
@ -47,7 +47,7 @@ info: `lint:not-iterable` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
info: lint:possibly-unresolved-reference: Name `x` used when possibly not defined
|
||||
info: possibly-unresolved-reference: Name `x` used when possibly not defined
|
||||
--> src/mdtest_snippet.py:16:17
|
||||
|
|
||||
14 | # revealed: Unknown
|
||||
|
|
|
@ -26,7 +26,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Bad` is not iterable
|
||||
error: not-iterable: Object of type `Bad` is not iterable
|
||||
--> src/mdtest_snippet.py:8:10
|
||||
|
|
||||
7 | # error: [not-iterable]
|
||||
|
|
|
@ -30,7 +30,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable` is not iterable
|
||||
error: not-iterable: Object of type `Iterable` is not iterable
|
||||
--> src/mdtest_snippet.py:12:10
|
||||
|
|
||||
11 | # error: [not-iterable]
|
||||
|
|
|
@ -41,7 +41,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/loops/for.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable1` is not iterable
|
||||
error: not-iterable: Object of type `Iterable1` is not iterable
|
||||
--> src/mdtest_snippet.py:19:10
|
||||
|
|
||||
18 | # error: [not-iterable]
|
||||
|
@ -70,7 +70,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Iterable2` is not iterable
|
||||
error: not-iterable: Object of type `Iterable2` is not iterable
|
||||
--> src/mdtest_snippet.py:23:10
|
||||
|
|
||||
22 | # error: [not-iterable]
|
||||
|
|
|
@ -68,7 +68,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:12:15
|
||||
|
|
||||
10 | reveal_type(f(True)) # revealed: Literal[True]
|
||||
|
|
|
@ -83,7 +83,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:13:15
|
||||
|
|
||||
11 | reveal_type(f(None)) # revealed: None
|
||||
|
|
|
@ -65,7 +65,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:9:15
|
||||
|
|
||||
7 | reveal_type(f(True)) # revealed: Literal[True]
|
||||
|
|
|
@ -80,7 +80,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:10:15
|
||||
|
|
||||
8 | reveal_type(f(None)) # revealed: None
|
||||
|
|
|
@ -24,7 +24,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/binary/instances.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:7:8
|
||||
|
|
||||
6 | # error: [unsupported-bool-conversion]
|
||||
|
|
|
@ -21,7 +21,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:4:5
|
||||
|
|
||||
2 | return x * x
|
||||
|
|
|
@ -23,7 +23,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:6:10
|
||||
|
|
||||
5 | c = C()
|
||||
|
|
|
@ -27,7 +27,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:3:13
|
||||
|
|
||||
1 | import package
|
||||
|
|
|
@ -22,7 +22,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:2:9
|
||||
|
|
||||
1 | def bar():
|
||||
|
|
|
@ -21,7 +21,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:4:8
|
||||
|
|
||||
2 | return x * y * z
|
||||
|
|
|
@ -25,7 +25,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:8:8
|
||||
|
|
||||
6 | return x * y * z
|
||||
|
|
|
@ -24,7 +24,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:7:5
|
||||
|
|
||||
5 | # error: [invalid-argument-type]
|
||||
|
@ -44,7 +44,7 @@ info: `lint:invalid-argument-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:7:10
|
||||
|
|
||||
5 | # error: [invalid-argument-type]
|
||||
|
@ -64,7 +64,7 @@ info: `lint:invalid-argument-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:7:15
|
||||
|
|
||||
5 | # error: [invalid-argument-type]
|
||||
|
|
|
@ -20,7 +20,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:3:12
|
||||
|
|
||||
1 | import json
|
||||
|
|
|
@ -21,7 +21,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:4:11
|
||||
|
|
||||
2 | return x * y * z
|
||||
|
|
|
@ -21,7 +21,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:4:11
|
||||
|
|
||||
2 | return x * y * z
|
||||
|
|
|
@ -21,7 +21,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:4:11
|
||||
|
|
||||
2 | return x * y * z
|
||||
|
|
|
@ -21,7 +21,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:4:8
|
||||
|
|
||||
2 | return x * y * z
|
||||
|
|
|
@ -23,7 +23,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:6:3
|
||||
|
|
||||
5 | c = C()
|
||||
|
|
|
@ -21,7 +21,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:4:14
|
||||
|
|
||||
2 | return len(numbers)
|
||||
|
|
|
@ -21,7 +21,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/invalid_argu
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Argument to this function is incorrect
|
||||
error: invalid-argument-type: Argument to this function is incorrect
|
||||
--> src/mdtest_snippet.py:4:20
|
||||
|
|
||||
2 | return len(numbers)
|
||||
|
|
|
@ -28,7 +28,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/comparison/instances/mem
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:9:1
|
||||
|
|
||||
8 | # error: [unsupported-bool-conversion]
|
||||
|
@ -43,7 +43,7 @@ info: `lint:unsupported-bool-conversion` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:11:1
|
||||
|
|
||||
9 | 10 in WithContains()
|
||||
|
|
|
@ -100,7 +100,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/mro.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:duplicate-base: Duplicate base class `str`
|
||||
error: duplicate-base: Duplicate base class `str`
|
||||
--> src/mdtest_snippet.py:3:7
|
||||
|
|
||||
1 | from typing_extensions import reveal_type
|
||||
|
@ -141,7 +141,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:duplicate-base: Duplicate base class `Spam`
|
||||
error: duplicate-base: Duplicate base class `Spam`
|
||||
--> src/mdtest_snippet.py:16:7
|
||||
|
|
||||
14 | # error: [duplicate-base] "Duplicate base class `Spam`"
|
||||
|
@ -179,7 +179,7 @@ info: `lint:duplicate-base` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:duplicate-base: Duplicate base class `Eggs`
|
||||
error: duplicate-base: Duplicate base class `Eggs`
|
||||
--> src/mdtest_snippet.py:16:7
|
||||
|
|
||||
14 | # error: [duplicate-base] "Duplicate base class `Spam`"
|
||||
|
@ -230,7 +230,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:duplicate-base: Duplicate base class `Mushrooms`
|
||||
error: duplicate-base: Duplicate base class `Mushrooms`
|
||||
--> src/mdtest_snippet.py:30:7
|
||||
|
|
||||
29 | class Mushrooms: ...
|
||||
|
@ -269,7 +269,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:duplicate-base: Duplicate base class `Eggs`
|
||||
error: duplicate-base: Duplicate base class `Eggs`
|
||||
--> src/mdtest_snippet.py:37:7
|
||||
|
|
||||
36 | # error: [duplicate-base] "Duplicate base class `Eggs`"
|
||||
|
@ -314,7 +314,7 @@ info: `lint:duplicate-base` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:duplicate-base: Duplicate base class `A`
|
||||
error: duplicate-base: Duplicate base class `A`
|
||||
--> src/mdtest_snippet.py:69:7
|
||||
|
|
||||
68 | # error: [duplicate-base]
|
||||
|
@ -345,7 +345,7 @@ info: `lint:duplicate-base` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
info: lint:unused-ignore-comment
|
||||
info: unused-ignore-comment
|
||||
--> src/mdtest_snippet.py:72:9
|
||||
|
|
||||
70 | A,
|
||||
|
@ -358,7 +358,7 @@ info: lint:unused-ignore-comment
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:duplicate-base: Duplicate base class `A`
|
||||
error: duplicate-base: Duplicate base class `A`
|
||||
--> src/mdtest_snippet.py:76:7
|
||||
|
|
||||
75 | # error: [duplicate-base]
|
||||
|
@ -388,7 +388,7 @@ info: `lint:duplicate-base` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
info: lint:unused-ignore-comment
|
||||
info: unused-ignore-comment
|
||||
--> src/mdtest_snippet.py:81:13
|
||||
|
|
||||
79 | ):
|
||||
|
|
|
@ -18,7 +18,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/no_matching_
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:no-matching-overload: No overload of class `type` matches arguments
|
||||
error: no-matching-overload: No overload of class `type` matches arguments
|
||||
--> src/mdtest_snippet.py:1:1
|
||||
|
|
||||
1 | type("Foo", ()) # error: [no-matching-overload]
|
||||
|
|
|
@ -22,7 +22,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/unary/not.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:5:1
|
||||
|
|
||||
4 | # error: [unsupported-bool-conversion]
|
||||
|
|
|
@ -35,7 +35,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/overloads.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: Overloaded function `func` requires at least two overloads
|
||||
error: invalid-overload: Overloaded function `func` requires at least two overloads
|
||||
--> src/mdtest_snippet.py:4:5
|
||||
|
|
||||
3 | @overload
|
||||
|
@ -52,7 +52,7 @@ info: `lint:invalid-overload` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: Overloaded function `func` requires at least two overloads
|
||||
error: invalid-overload: Overloaded function `func` requires at least two overloads
|
||||
--> src/mdtest_snippet.pyi:5:5
|
||||
|
|
||||
3 | @overload
|
||||
|
|
|
@ -72,7 +72,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/overloads.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: Overloaded function `try_from1` does not use the `@classmethod` decorator consistently
|
||||
error: invalid-overload: Overloaded function `try_from1` does not use the `@classmethod` decorator consistently
|
||||
--> src/mdtest_snippet.py:13:9
|
||||
|
|
||||
11 | def try_from1(cls, x: int) -> CheckClassMethod: ...
|
||||
|
@ -91,7 +91,7 @@ info: `lint:invalid-overload` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: Overloaded function `try_from2` does not use the `@classmethod` decorator consistently
|
||||
error: invalid-overload: Overloaded function `try_from2` does not use the `@classmethod` decorator consistently
|
||||
--> src/mdtest_snippet.py:28:9
|
||||
|
|
||||
26 | @classmethod
|
||||
|
@ -114,7 +114,7 @@ info: `lint:invalid-overload` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: Overloaded function `try_from3` does not use the `@classmethod` decorator consistently
|
||||
error: invalid-overload: Overloaded function `try_from3` does not use the `@classmethod` decorator consistently
|
||||
--> src/mdtest_snippet.py:40:9
|
||||
|
|
||||
38 | def try_from3(cls, x: str) -> None: ...
|
||||
|
|
|
@ -65,7 +65,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/overloads.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: `@final` decorator should be applied only to the overload implementation
|
||||
error: invalid-overload: `@final` decorator should be applied only to the overload implementation
|
||||
--> src/mdtest_snippet.py:18:9
|
||||
|
|
||||
16 | def method2(self, x: str) -> str: ...
|
||||
|
@ -81,7 +81,7 @@ info: `lint:invalid-overload` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: `@final` decorator should be applied only to the overload implementation
|
||||
error: invalid-overload: `@final` decorator should be applied only to the overload implementation
|
||||
--> src/mdtest_snippet.py:27:9
|
||||
|
|
||||
25 | def method3(self, x: str) -> str: ...
|
||||
|
@ -97,7 +97,7 @@ info: `lint:invalid-overload` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: `@final` decorator should be applied only to the first overload
|
||||
error: invalid-overload: `@final` decorator should be applied only to the first overload
|
||||
--> src/mdtest_snippet.pyi:11:9
|
||||
|
|
||||
10 | @overload
|
||||
|
|
|
@ -82,7 +82,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/overloads.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: `@override` decorator should be applied only to the overload implementation
|
||||
error: invalid-overload: `@override` decorator should be applied only to the overload implementation
|
||||
--> src/mdtest_snippet.py:27:9
|
||||
|
|
||||
25 | def method(self, x: str) -> str: ...
|
||||
|
@ -98,7 +98,7 @@ info: `lint:invalid-overload` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: `@override` decorator should be applied only to the overload implementation
|
||||
error: invalid-overload: `@override` decorator should be applied only to the overload implementation
|
||||
--> src/mdtest_snippet.py:37:9
|
||||
|
|
||||
35 | def method(self, x: str) -> str: ...
|
||||
|
@ -114,7 +114,7 @@ info: `lint:invalid-overload` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: `@override` decorator should be applied only to the first overload
|
||||
error: invalid-overload: `@override` decorator should be applied only to the first overload
|
||||
--> src/mdtest_snippet.pyi:18:9
|
||||
|
|
||||
16 | class Sub2(Base):
|
||||
|
|
|
@ -31,7 +31,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/overloads.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: Overloaded non-stub function `func` must have an implementation
|
||||
error: invalid-overload: Overloaded non-stub function `func` must have an implementation
|
||||
--> src/mdtest_snippet.py:7:5
|
||||
|
|
||||
5 | @overload
|
||||
|
@ -46,7 +46,7 @@ info: `lint:invalid-overload` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-overload: Overloaded non-stub function `method` must have an implementation
|
||||
error: invalid-overload: Overloaded non-stub function `method` must have an implementation
|
||||
--> src/mdtest_snippet.py:14:9
|
||||
|
|
||||
12 | @overload
|
||||
|
|
|
@ -42,7 +42,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/protocols.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:call-non-callable: Object of type `typing.Protocol` is not callable
|
||||
error: call-non-callable: Object of type `typing.Protocol` is not callable
|
||||
--> src/mdtest_snippet.py:4:13
|
||||
|
|
||||
3 | # error: [call-non-callable]
|
||||
|
@ -69,7 +69,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:call-non-callable: Cannot instantiate class `MyProtocol`
|
||||
error: call-non-callable: Cannot instantiate class `MyProtocol`
|
||||
--> src/mdtest_snippet.py:10:13
|
||||
|
|
||||
9 | # error: [call-non-callable] "Cannot instantiate class `MyProtocol`"
|
||||
|
@ -105,7 +105,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:call-non-callable: Cannot instantiate class `GenericProtocol`
|
||||
error: call-non-callable: Cannot instantiate class `GenericProtocol`
|
||||
--> src/mdtest_snippet.py:16:13
|
||||
|
|
||||
15 | # error: [call-non-callable] "Cannot instantiate class `GenericProtocol`"
|
||||
|
|
|
@ -29,7 +29,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/protocols.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Invalid argument to `get_protocol_members`
|
||||
error: invalid-argument-type: Invalid argument to `get_protocol_members`
|
||||
--> src/mdtest_snippet.py:5:1
|
||||
|
|
||||
3 | class NotAProtocol: ...
|
||||
|
@ -57,7 +57,7 @@ info: `lint:invalid-argument-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Invalid argument to `get_protocol_members`
|
||||
error: invalid-argument-type: Invalid argument to `get_protocol_members`
|
||||
--> src/mdtest_snippet.py:9:1
|
||||
|
|
||||
7 | class AlsoNotAProtocol(NotAProtocol, object): ...
|
||||
|
|
|
@ -57,7 +57,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/protocols.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Class `HasX` cannot be used as the second argument to `isinstance`
|
||||
error: invalid-argument-type: Class `HasX` cannot be used as the second argument to `isinstance`
|
||||
--> src/mdtest_snippet.py:7:8
|
||||
|
|
||||
6 | def f(arg: object, arg2: type):
|
||||
|
@ -110,7 +110,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-argument-type: Class `HasX` cannot be used as the second argument to `issubclass`
|
||||
error: invalid-argument-type: Class `HasX` cannot be used as the second argument to `issubclass`
|
||||
--> src/mdtest_snippet.py:12:8
|
||||
|
|
||||
10 | reveal_type(arg) # revealed: ~HasX
|
||||
|
|
|
@ -54,7 +54,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/function/return_type.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Return type does not match returned value
|
||||
error: invalid-return-type: Return type does not match returned value
|
||||
--> src/mdtest_snippet.py:19:12
|
||||
|
|
||||
17 | yield from i()
|
||||
|
@ -71,7 +71,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Return type does not match returned value
|
||||
error: invalid-return-type: Return type does not match returned value
|
||||
--> src/mdtest_snippet.py:36:18
|
||||
|
|
||||
34 | yield 42
|
||||
|
|
|
@ -31,7 +31,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/function/return_type.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Return type does not match returned value
|
||||
error: invalid-return-type: Return type does not match returned value
|
||||
--> src/mdtest_snippet.py:1:22
|
||||
|
|
||||
1 | def f(cond: bool) -> str:
|
||||
|
@ -50,7 +50,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Return type does not match returned value
|
||||
error: invalid-return-type: Return type does not match returned value
|
||||
--> src/mdtest_snippet.py:8:22
|
||||
|
|
||||
6 | return 1
|
||||
|
@ -69,7 +69,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Return type does not match returned value
|
||||
error: invalid-return-type: Return type does not match returned value
|
||||
--> src/mdtest_snippet.py:14:16
|
||||
|
|
||||
12 | else:
|
||||
|
|
|
@ -40,7 +40,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/function/return_type.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Return type does not match returned value
|
||||
error: invalid-return-type: Return type does not match returned value
|
||||
--> src/mdtest_snippet.py:1:12
|
||||
|
|
||||
1 | def f() -> None:
|
||||
|
@ -57,7 +57,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
error: invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
--> src/mdtest_snippet.py:7:22
|
||||
|
|
||||
6 | # error: [invalid-return-type]
|
||||
|
@ -71,7 +71,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
error: invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
--> src/mdtest_snippet.py:12:22
|
||||
|
|
||||
11 | # error: [invalid-return-type]
|
||||
|
@ -85,7 +85,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
error: invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
--> src/mdtest_snippet.py:17:22
|
||||
|
|
||||
16 | # error: [invalid-return-type]
|
||||
|
|
|
@ -35,7 +35,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/function/return_type.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
error: invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
--> src/mdtest_snippet.py:2:12
|
||||
|
|
||||
1 | # error: [invalid-return-type]
|
||||
|
@ -48,7 +48,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Return type does not match returned value
|
||||
error: invalid-return-type: Return type does not match returned value
|
||||
--> src/mdtest_snippet.py:5:12
|
||||
|
|
||||
3 | 1
|
||||
|
@ -66,7 +66,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Return type does not match returned value
|
||||
error: invalid-return-type: Return type does not match returned value
|
||||
--> src/mdtest_snippet.py:9:12
|
||||
|
|
||||
7 | return 1
|
||||
|
@ -84,7 +84,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `T`
|
||||
error: invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `T`
|
||||
--> src/mdtest_snippet.py:18:16
|
||||
|
|
||||
17 | # error: [invalid-return-type]
|
||||
|
|
|
@ -30,7 +30,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/function/return_type.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Return type does not match returned value
|
||||
error: invalid-return-type: Return type does not match returned value
|
||||
--> src/mdtest_snippet.pyi:1:12
|
||||
|
|
||||
1 | def f() -> int:
|
||||
|
@ -46,7 +46,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
error: invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
--> src/mdtest_snippet.pyi:6:14
|
||||
|
|
||||
5 | # error: [invalid-return-type]
|
||||
|
@ -60,7 +60,7 @@ info: `lint:invalid-return-type` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
error: invalid-return-type: Function can implicitly return `None`, which is not assignable to return type `int`
|
||||
--> src/mdtest_snippet.pyi:11:14
|
||||
|
|
||||
10 | # error: [invalid-return-type]
|
||||
|
|
|
@ -33,7 +33,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/comparison/instances/ric
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:12:1
|
||||
|
|
||||
11 | # error: [unsupported-bool-conversion]
|
||||
|
@ -48,7 +48,7 @@ info: `lint:unsupported-bool-conversion` is enabled by default
|
|||
```
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:14:1
|
||||
|
|
||||
12 | 10 < Comparable() < 20
|
||||
|
|
|
@ -20,7 +20,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/shadowing.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Implicit shadowing of class `C`
|
||||
error: invalid-assignment: Implicit shadowing of class `C`
|
||||
--> src/mdtest_snippet.py:3:1
|
||||
|
|
||||
1 | class C: ...
|
||||
|
|
|
@ -20,7 +20,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/shadowing.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Implicit shadowing of function `f`
|
||||
error: invalid-assignment: Implicit shadowing of function `f`
|
||||
--> src/mdtest_snippet.py:3:1
|
||||
|
|
||||
1 | def f(): ...
|
||||
|
|
|
@ -34,7 +34,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/comparison/tuples.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable | Literal[False]`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable | Literal[False]`
|
||||
--> src/mdtest_snippet.py:15:1
|
||||
|
|
||||
14 | # error: [unsupported-bool-conversion]
|
||||
|
|
|
@ -26,7 +26,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/comparison/tuples.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:9:1
|
||||
|
|
||||
8 | # error: [unsupported-bool-conversion]
|
||||
|
|
|
@ -18,7 +18,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unpacking.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Not enough values to unpack
|
||||
error: invalid-assignment: Not enough values to unpack
|
||||
--> src/mdtest_snippet.py:1:1
|
||||
|
|
||||
1 | a, b = (1,) # error: [invalid-assignment]
|
||||
|
|
|
@ -18,7 +18,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unpacking.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Too many values to unpack
|
||||
error: invalid-assignment: Too many values to unpack
|
||||
--> src/mdtest_snippet.py:1:1
|
||||
|
|
||||
1 | a, b = (1, 2, 3) # error: [invalid-assignment]
|
||||
|
|
|
@ -18,7 +18,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unpacking.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:not-iterable: Object of type `Literal[1]` is not iterable
|
||||
error: not-iterable: Object of type `Literal[1]` is not iterable
|
||||
--> src/mdtest_snippet.py:1:8
|
||||
|
|
||||
1 | a, b = 1 # error: [not-iterable]
|
||||
|
|
|
@ -18,7 +18,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unpacking.md
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:invalid-assignment: Not enough values to unpack
|
||||
error: invalid-assignment: Not enough values to unpack
|
||||
--> src/mdtest_snippet.py:1:1
|
||||
|
|
||||
1 | [a, *b, c, d] = (1, 2) # error: [invalid-assignment]
|
||||
|
|
|
@ -20,7 +20,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unresolved_i
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
error: unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
--> src/mdtest_snippet.py:1:8
|
||||
|
|
||||
1 | import does_not_exist # error: [unresolved-import]
|
||||
|
|
|
@ -25,7 +25,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unresolved_i
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Module `a` has no member `does_not_exist`
|
||||
error: unresolved-import: Module `a` has no member `does_not_exist`
|
||||
--> src/mdtest_snippet.py:1:28
|
||||
|
|
||||
1 | from a import does_exist1, does_not_exist, does_exist2 # error: [unresolved-import]
|
||||
|
|
|
@ -20,7 +20,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unresolved_i
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Cannot resolve imported module `.does_not_exist`
|
||||
error: unresolved-import: Cannot resolve imported module `.does_not_exist`
|
||||
--> src/mdtest_snippet.py:1:7
|
||||
|
|
||||
1 | from .does_not_exist import add # error: [unresolved-import]
|
||||
|
|
|
@ -20,7 +20,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unresolved_i
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Cannot resolve imported module `.does_not_exist.foo.bar`
|
||||
error: unresolved-import: Cannot resolve imported module `.does_not_exist.foo.bar`
|
||||
--> src/mdtest_snippet.py:1:7
|
||||
|
|
||||
1 | from .does_not_exist.foo.bar import add # error: [unresolved-import]
|
||||
|
|
|
@ -20,7 +20,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unresolved_i
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
error: unresolved-import: Cannot resolve imported module `does_not_exist`
|
||||
--> src/mdtest_snippet.py:1:6
|
||||
|
|
||||
1 | from does_not_exist import add # error: [unresolved-import]
|
||||
|
|
|
@ -32,7 +32,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unresolved_i
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unresolved-import: Cannot resolve imported module `....foo`
|
||||
error: unresolved-import: Cannot resolve imported module `....foo`
|
||||
--> src/package/subpackage/subsubpackage/__init__.py:1:10
|
||||
|
|
||||
1 | from ....foo import add # error: [unresolved-import]
|
||||
|
|
|
@ -24,7 +24,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unsupported_
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:7:8
|
||||
|
|
||||
6 | # error: [unsupported-bool-conversion]
|
||||
|
|
|
@ -25,7 +25,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unsupported_
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:8:8
|
||||
|
|
||||
7 | # error: [unsupported-bool-conversion]
|
||||
|
|
|
@ -25,7 +25,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unsupported_
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for type `NotBoolable`
|
||||
--> src/mdtest_snippet.py:8:8
|
||||
|
|
||||
7 | # error: [unsupported-bool-conversion]
|
||||
|
|
|
@ -32,7 +32,7 @@ mdtest path: crates/ty_python_semantic/resources/mdtest/diagnostics/unsupported_
|
|||
# Diagnostics
|
||||
|
||||
```
|
||||
error: lint:unsupported-bool-conversion: Boolean conversion is unsupported for union `NotBoolable1 | NotBoolable2 | NotBoolable3` because `NotBoolable1` doesn't implement `__bool__` correctly
|
||||
error: unsupported-bool-conversion: Boolean conversion is unsupported for union `NotBoolable1 | NotBoolable2 | NotBoolable3` because `NotBoolable1` doesn't implement `__bool__` correctly
|
||||
--> src/mdtest_snippet.py:15:8
|
||||
|
|
||||
14 | # error: [unsupported-bool-conversion]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue