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

Better explanation for reasoning behind invalid-name warnings #6053

Open
Pierre-Sassoulas opened this issue Mar 30, 2022 · 2 comments
Open
Labels
C: invalid-name Enhancement ✨ Improvement to a component Needs decision 🔒 Needs a decision before implemention or rejection

Comments

@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented Mar 30, 2022

Current problem

We're getting a lot of report for the new TypeVar naming style lately (#6050, #6003). It's probably annoying users. We took a decision but it's not conveyed in the warning message. We also have a long standing issue with snake_case requiring to be more than 3 letters and less than 30 characters long but not explaining it properly (the regex behind it is also hidden).

Desired solution

We could replace doesn't conform to predefined naming style by ``is not in snake_case and between 3 and 30 char long" by adding a description attribute to NameStyle. It's a lot easier to do than to actually refactor the checker to separate length and name style.

Additional context

#2018

@mwgamble
Copy link

It would be great if the error messages could get more specific when necessary. For example, if a variable named ThingType is detected, it should explicitly tell the user that the Type suffix is forbidden.

@Pierre-Sassoulas Pierre-Sassoulas added the Needs decision 🔒 Needs a decision before implemention or rejection label Jul 14, 2022
@bmitc
Copy link

bmitc commented Apr 4, 2024

An improved error message would indeed be very helpful, especially since this is a bit contentious and a strict convention. I just hit upon this today, as it's quite natural to suffix with Type to distinguish it from a real type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: invalid-name Enhancement ✨ Improvement to a component Needs decision 🔒 Needs a decision before implemention or rejection
Projects
None yet
Development

No branches or pull requests

3 participants