-
-
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
Default TypeVar
style for invalid-name
too strict
#5981
Comments
I'm still encountering this issue with pylint 2.13.2
|
Please see the discussion in #6003. We have explicitly chosen to disallow |
Perfect, thank you ! :) |
pylint still seems to complain if there is an underscore to mark it as internal, is that intended? i.e. |
I don't think it is, but this is not in my recent memory anymore. @cdce8p @Pierre-Sassoulas Any opinion about this? |
There's a number of |
No, but we could allow a leading underscore in the default regex. That does make sense to me as I can see it as a common use case and something we might want to support by default without forcing users to overwrite the setting. |
Are you sure? It works for me. Could you please check your config and see if there is a custom naming style defined somewhere? from typing import TypeVar
_IPAddressT = TypeVar("_IPAddressT")
_IPAddressType = TypeVar("_IPAddressType")
|
Sorry I misunderstood the question really badly 😄 (I thought two consecutive capitalized letters in |
Here is an example to reproduce (at least for me on from typing import TypeVar
_IPAddressType = TypeVar("_IPAddressType", bound="IPAddress")
class IPAddress:
pass This works without error: from typing import TypeVar
_IPAddressT = TypeVar("_IPAddressT", bound="IPAddress")
class IPAddress:
pass Edit: After re-reading your comments it seems this is intended behavior. In that case I guess I'd expect the error to be a bit more helpful by stating the expected naming style |
Just to explain why
I would agree, however that's not as simple as it seems at first glance. Showing the full regex isn't helpful either probably and explaining would be too verbose. The also doesn't necessarily work if users choose a custom regex or naming style. |
If you check the docs for |
Bug description
would both lead to
Configuration
No response
Command used
pylint --jobs=0 *.py
Pylint output
Expected behavior
I would expect names beginning with multiple capital letters (like common abbreviations) to be valid TypeVar names, as they are for class names.
Pylint version
OS / Environment
macOS 12.3
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: