Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yilei opened this issue Apr 3, 2023 · 2 comments · Fixed by #8537 or #9093
Closed

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

yilei opened this issue Apr 3, 2023 · 2 comments · Fixed by #8537 or #9093
Assignees
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@yilei
Copy link
Contributor

yilei commented Apr 3, 2023

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.

@yilei yilei added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Apr 3, 2023
@Pierre-Sassoulas Pierre-Sassoulas added False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Apr 3, 2023
@Pierre-Sassoulas
Copy link
Member

Thank you for reporting and working on this. Is it a regression from pylint 2.17.2 ?

@yilei
Copy link
Contributor Author

yilei commented Apr 3, 2023

Not a regression, but a missed code path in #7116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
2 participants