Skip to content

invalid-name type alias false-positive for union values #8487

Closed
@The-Compiler

Description

@The-Compiler

Bug description

With something like:

# pylint: disable=missing-docstring
from typing import Union
x: Union[str, int] = 42

pylint claims a wrong type alias name, with no type aliases involved.

Configuration

No response

Command used

pylint test.py

Pylint output

************* Module test
.../test.py:3:0: C0103: Type alias name "x" doesn't conform to predefined naming style (invalid-name)

Expected behavior

No output

Pylint version

pylint 2.17.0
astroid 2.15.0
Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201]

also reproducible with the current main branches:

pylint 3.0.0a6
astroid 2.16.0dev0
Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions