-
Notifications
You must be signed in to change notification settings - Fork 23
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
Introduce a check disallowing module-level defaults, and improve Y015 error messages #145
Conversation
…ction of unused TypeVars
That looks like more typeshed hits than I was hoping for, but haven't got time to check them out now; will do so later. |
(I've found the bug in the PR, am working on a fix) |
Okay, I think this is ready for review now. Typeshed PR here: python/typeshed#7036 |
Co-authored-by: Akuli <[email protected]>
|
||
field0: int | ||
field_foo: int = ... # Y032 Default value unnecessary. Use "field_foo: int" instead of "field_foo: int = ..." | ||
field_bar: int = 0 # Y032 Default value unnecessary. Use "field_bar: int" instead of "field_bar: int = 0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like how this accounts for class members that just happen to use the same name. I find it confusing, and it seems like it will make refactoring stubs fragile and surprising.
Has anyone looked into disabling the flake8 undefined variable warning yet? Alternatively, would it be less work to not count instance attributes, argument names etc as using the global variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this bothers me too. I initially tried to work around it (see my first commit on this PR), but it was more complicated than I expected, so I gave up.
I have another idea for a fix, which I'll try tomorrow.
I think this PR has lost its way a little bit. I'm going to close it, propose some of the ideas in chunks, and rethink some of the other ideas. |
Closes #98