Files
ruff/docs/rules/prefix-type-params.md
Steve Dignam 67e58a024a Add flake8-pyi with one rule (#2682)
Add basic scaffold for [flake8-pyi](https://github.com/PyCQA/flake8-pyi) and the first rule, Y001

rel: https://github.com/charliermarsh/ruff/issues/848
2023-02-09 19:03:11 -05:00

463 B

prefix-type-params (PYI001)

Derived from the flake8-pyi linter.

What it does

Checks that type TypeVar, ParamSpec, and TypeVarTuple definitions in stubs are prefixed with _.

Why is this bad?

By prefixing type parameters with _, we can avoid accidentally exposing names internal to the stub.

Example

from typing import TypeVar

T = TypeVar("T")

Use instead:

from typing import TypeVar

_T = TypeVar("_T")