mirror of https://github.com/astral-sh/ruff
[ty] Fix rendering of unused suppression diagnostic (#21580)
This commit is contained in:
parent
859f9ec21a
commit
d24c891a4b
|
|
@ -303,13 +303,13 @@ info: rule `duplicate-base` is enabled by default
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
info[unused-ignore-comment]
|
info[unused-ignore-comment]: Unused blanket `type: ignore` directive
|
||||||
--> src/mdtest_snippet.py:72:9
|
--> src/mdtest_snippet.py:72:9
|
||||||
|
|
|
|
||||||
70 | A,
|
70 | A,
|
||||||
71 | # error: [unused-ignore-comment]
|
71 | # error: [unused-ignore-comment]
|
||||||
72 | A, # type: ignore[duplicate-base]
|
72 | A, # type: ignore[duplicate-base]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unused blanket `type: ignore` directive
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
73 | ): ...
|
73 | ): ...
|
||||||
|
|
|
|
||||||
|
|
||||||
|
|
@ -346,13 +346,13 @@ info: rule `duplicate-base` is enabled by default
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
info[unused-ignore-comment]
|
info[unused-ignore-comment]: Unused blanket `type: ignore` directive
|
||||||
--> src/mdtest_snippet.py:81:13
|
--> src/mdtest_snippet.py:81:13
|
||||||
|
|
|
|
||||||
79 | ):
|
79 | ):
|
||||||
80 | # error: [unused-ignore-comment]
|
80 | # error: [unused-ignore-comment]
|
||||||
81 | x: int # type: ignore[duplicate-base]
|
81 | x: int # type: ignore[duplicate-base]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unused blanket `type: ignore` directive
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
82 |
|
82 |
|
||||||
83 | # fmt: on
|
83 | # fmt: on
|
||||||
|
|
|
|
||||||
|
|
|
||||||
|
|
@ -297,10 +297,10 @@ impl<'a> CheckSuppressionsContext<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let id = DiagnosticId::Lint(lint.name());
|
let id = DiagnosticId::Lint(lint.name());
|
||||||
let mut diag = Diagnostic::new(id, severity, "");
|
let mut diag = Diagnostic::new(id, severity, message);
|
||||||
diag.set_documentation_url(Some(lint.documentation_url()));
|
diag.set_documentation_url(Some(lint.documentation_url()));
|
||||||
let span = Span::from(self.file).with_range(range);
|
let span = Span::from(self.file).with_range(range);
|
||||||
diag.annotate(Annotation::primary(span).message(message));
|
diag.annotate(Annotation::primary(span));
|
||||||
self.diagnostics.push(diag);
|
self.diagnostics.push(diag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue