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

invalid-name check for TypeAlias should allow for digits in names #8485

Closed
sodul opened this issue Mar 22, 2023 · 3 comments · Fixed by #8488, #8521 or #9093
Closed

invalid-name check for TypeAlias should allow for digits in names #8485

sodul opened this issue Mar 22, 2023 · 3 comments · Fixed by #8488, #8521 or #9093
Labels
C: invalid-name False Positive 🦟 A message is emitted but nothing is wrong with the code Help wanted 🙏 Outside help would be appreciated, good for new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@sodul
Copy link
Contributor

sodul commented Mar 22, 2023

Bug description

from typing import Union

Ec2Data = Union[int, str]

Configuration

No response

Command used

pylint ec2.py

Pylint output

Type alias name "Ec2Data" doesn't conform to predefined naming style (3:0) [invalid-name]

Expected behavior

Digits in variable names are pretty common and should be allowed. In the example above we work with EC2 and there is not good substitute for using a digit.

We believe pylint is being too strict in the new check introduced in #7116.

Pylint version

pylint 2.17.0
astroid 2.15.0
Python 3.11.2 (main, Mar 20 2023, 21:17:15) [Clang 14.0.0 (clang-1400.0.29.202)]

OS / Environment

MacOS 13.2.1

Additional dependencies

No response

@sodul sodul added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 22, 2023
@DanielNoord
Copy link
Collaborator

You are correct! Would you want to open a PR for this? You have identified the correct PR. We can just change the regex and add a new test case.

@DanielNoord DanielNoord added Help wanted 🙏 Outside help would be appreciated, good for new contributors False Positive 🦟 A message is emitted but nothing is wrong with the code C: invalid-name 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 Mar 23, 2023
@DanielNoord DanielNoord added this to the 2.17.2 milestone Mar 23, 2023
@sodul
Copy link
Contributor Author

sodul commented Mar 23, 2023

While looking at the code I noticed that TypeVars have the same issue with integers. It seems a tad bit more complicated to fix though. I can open a separate bug report for it but I won't have time to send a PR in the short term.

@DanielNoord
Copy link
Collaborator

While looking at the code I noticed that TypeVars have the same issue with integers. It seems a tad bit more complicated to fix though. I can open a separate bug report for it but I won't have time to send a PR in the short term.

Let's create another issue to track and fix this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: invalid-name False Positive 🦟 A message is emitted but nothing is wrong with the code Help wanted 🙏 Outside help would be appreciated, good for new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
2 participants