Skip to content

Commit

Permalink
Fix error in t-suffixed-type-alias (PYI043) example (#8963)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
tjkuson authored Dec 2, 2023
1 parent 5aaf99b commit 35082b2
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 35082b2

Please sign in to comment.