-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 on TypeVar definition containing "Type" as part of the name #6003
Comments
You're correct that PEP 8 only mentions I.e. |
Thanks for the clarification. Then I assume I can adopt this convention in my code and this issue can be closed (at least from my point of view I don't have a strong opinion in favor or against it) |
Using `UserT` is [not supported by pylint](pylint-dev/pylint#6003), use `UserT` instead. feat(questionary#Exit when using control + c): Exit when using control + c If you want the question to exit when it receives a `KeyboardInterrupt` event, use `unsafe_ask` instead of `ask`. fix(task_workflows): Update the task workflow of the month, and week plannings
It would be great if the messages users see when encountering errors like this were more helpful. A message like this:
Is incredibly unhelpful. It doesn't tell me what the predefined naming style is, nor where to find out what it is. It doesn't even explicitly tell me what is wrong with the name that has been chosen, despite the fact that forbidding the |
Updated URL for referenced doc: |
Why: *Type is an invalid name according to pylint. They recommend using the suffix T instead of Type: pylint-dev/pylint#6003 (comment)
Why: *Type is an invalid name according to pylint. They recommend using the suffix T instead of Type: pylint-dev/pylint#6003 (comment)
Bug description
for the following Generic alias declaration:
a.py
pylint issues an invalid-name warning (apparently cause the Type suffix in the name).
According to PEP-8 https://peps.python.org/pep-0008/#type-variable-names
TypeVar should use "CapWords" naming convention, with the option of _ + suffix,
but no mention about using "Type" or not as part of the name. (I might be missing something, so please correct me if I'm wrong)
Removing the "Type" suffix from the name fixes the issue.
I discovered this not based on PEP-8 but mostly cause other languages using generics types allow CapWords with any content to be used generic type names (like Java, Scala, C...). I might be wrong but I hope this helps clarifying the issue.
Configuration
No response
Command used
Pylint output
Expected behavior
No warning for correctly CapWord cased TypeVar.
Pylint version
OS / Environment
PopOS/Ubuntu:
Linux 5.16.11-76051611-generic #202202230823
164624826121.10~2b22243Wed Mar 2 20: x86_64 x86_64 x86_64 GNU/Linux
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: