-
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
improvements to Assign check #76
Conversation
Y090 = "Y090 Use explicit attributes instead of assignments in __init__" | ||
Y091 = 'Y091 Function body must not contain "raise"' | ||
Y092 = "Y092 Top-level attribute must not have a default value" | ||
Y093 = "Y093 Use typing_extensions.TypeAlias for type aliases" |
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.
It seems like Y09* are used for disabled by default errors. Was the intention to add Y093 to that list?
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.
Yes, because we can't use it for typeshed yet (because of missing support in pytype I believe). We might have to rethink this convention though; the other Y09* checks can probably be safely enabled by default.
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.
Cool, maybe then let's make this Y018, assuming we want to turn this on once all type checkers have support.
I couldn't find any hits for Y09* error codes on grep.app and cs.github.com so we could probably easily change the other error codes too if we wanted.
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'd like to land it as Y093 first; making a non-Y09* code disabled by default is likely complicated.
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.
Afaict there isn't any magic, it's just whatever is in DISABLED_BY_DEFAULT
on L539, which this isn't and should be. Sorry, my initial comment could have been clearer.
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.
Not quite, there's also special casing in should_warn
on line 479.
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.
Good catch, maybe that should just check for membership in DISABLED_BY_DEFAULT
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.
No, because it also needs to support --select=Y09
. I'd rather keep the existing structure for this PR and revisit it when we address #75.
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.
Okay, makes sense. Maybe I'm being thick, but we still need to add Y093
to DISABLED_BY_DEFAULT
right (as per my first comment)?
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.
Good catch, applied that
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
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.
Lgtm, but I wouldn't mind adding tests for the new errors!
I forgot to git add again didn't I. |
Fixes #44