Skip to content

TypeAlias defined inside functions doesn't respect the typealias naming style. #8536

@yilei

Description

@yilei

Bug description

Example code:

# pylint: disable=missing-docstring
from typing import TypeAlias

GoodTopLevelName: TypeAlias = int
bad_top_level_name: TypeAlias = int


def my_func():
    GoodLocalName: TypeAlias = int
    bad_local_name : TypeAlias = int
    del GoodLocalName, bad_local_name

Configuration

No response

Command used

pylint t.py

Pylint output

t.py:5:0: C0103: Type alias name "bad_top_level_name" doesn't conform to predefined naming style (invalid-name)

Expected behavior

It should also raise invalid-name for the bad_local_name variable

Pylint version

pylint 2.17.2
astroid 2.15.2
Python 3.11.2 (main, Mar  3 2023, 16:02:46) [GCC 12.2.0]

OS / Environment

No response

Additional dependencies

I having a PR coming.

Metadata

Metadata

Assignees

Labels

False Negative 🦋No message is emitted but something is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions