-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
C: invalid-nameEnhancement ✨Improvement to a componentImprovement to a componentNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Current problem
Python typing.TypeAlias
are an alias to a type (as we all know). Thus, I think TypeAlias
should have to follow type naming conventions (e.g. PascalCase for classes, unless a primitive).
In other words, we should see TypeAlias
really as not much different from a novel class
in regards to naming conventions. I think pylint is the tool to help enforce this!
Desired solution
Please see the below code snippet
# pylint: disable=missing-module-docstring
from threading import Thread # Placeholder class
from typing import TypeAlias
ThreadAlias: TypeAlias = Thread # Say nothing here
THREAD_ALIAS: TypeAlias = Thread # Throw invalid-name
# C0103: Type alias "THREAD_ALIAS" doesn't conform to PascalCase naming style (invalid-name)
To restate, I think pylint should error on CLASS_NAME_ALIAS
with invalid-name
.
Additional context
See the TypeAlias PEP: https://peps.python.org/pep-0613/#error-messaging
They use ClassName
, not CLASS_NAME
.
cdce8p
Metadata
Metadata
Assignees
Labels
C: invalid-nameEnhancement ✨Improvement to a componentImprovement to a componentNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation