mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:41:23 +00:00
Fix error in t-suffixed-type-alias
(PYI043
) example (#8963)
## Summary For `t-suffixed-type-alias` to trigger, the type alias needs to be marked as such using the `typing.TypeAlias` annotation and the name of the alias must be marked as private using a leading underscore. The documentation example was of an unannotated type alias that was not marked as private, which was misleading. ## Test Plan The current example doesn't trigger the rule; the example in this merge request does.
This commit is contained in:
parent
5aaf99b856
commit
35082b28cd
1 changed files with 6 additions and 2 deletions
|
@ -46,12 +46,16 @@ impl Violation for SnakeCaseTypeAlias {
|
|||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
/// MyTypeT = int
|
||||
/// from typing import TypeAlias
|
||||
///
|
||||
/// _MyTypeT: TypeAlias = int
|
||||
/// ```
|
||||
///
|
||||
/// Use instead:
|
||||
/// ```python
|
||||
/// MyType = int
|
||||
/// from typing import TypeAlias
|
||||
///
|
||||
/// _MyType: TypeAlias = int
|
||||
/// ```
|
||||
#[violation]
|
||||
pub struct TSuffixedTypeAlias {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue