[ty] Add missing-type-argument lint rule by reginaldl · Pull Request #25617 · astral-sh/ruff (original) (raw)

@reginaldl

Add a new lint that detects generic types used without explicit type parameters in annotations (e.g. list instead of list[int]). This is equivalent to mypy's --disallow-any-generics and pyright's reportMissingTypeArgument.

The rule defaults to Level::Ignore (opt-in) and can be enabled via:

[rules]
missing-type-argument = "warn"

It skips classes where all type parameters have PEP 696 defaults. Added tests covering stdlib generics, user-defined generics, PEP 696 defaults, dotted names, function signatures, and variable annotations.