-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
Update to mypy 0.991 for compatible-mypy & CI #1260
Conversation
0d42a91
to
8aaaee9
Compare
8aaaee9
to
075caf5
Compare
84993cf
to
32f18cd
Compare
3b8cbb6
to
9115891
Compare
warn_unused_ignores = True | ||
warn_redundant_casts = True | ||
warn_unused_configs = True | ||
warn_unreachable = True | ||
disallow_untyped_defs = true | ||
disallow_incomplete_defs = true | ||
show_error_codes = False |
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.
show_error_codes
default changed in mypy 0.990.
I'm reverting to the old behavior, because so many .yml
test files have mypy error messages without the error code.
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.
Should we try to work towards show_error_codes = True
? It feels reasonable that tests are granular enough to fail if a specific error code changes.
It could be an option to try to resolve this over time. Best thing would probably be to have a linter that disallows type: ignore
i.e. without code in the test suite. I suppose that could be tracked in an issue.
warn_unused_ignores = True | ||
warn_redundant_casts = True | ||
warn_unused_configs = True | ||
warn_unreachable = True | ||
disallow_untyped_defs = true | ||
disallow_incomplete_defs = true | ||
show_error_codes = False | ||
disable_error_code = empty-body |
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.
Replaced warn_no_return = False
with disable_error_code = empty-body
, the latter is less dangerous as it now only applies to empty functions.
@@ -309,6 +311,8 @@ def get_type_analyze_hook(self, fullname: str) -> Optional[Callable[[AnalyzeType | |||
"django_stubs_ext.annotations.WithAnnotations", | |||
): | |||
return partial(handle_annotated_type, django_context=self.django_context) | |||
else: | |||
return None |
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.
This was added because I removed warn_no_return = False
mypy setting.
I really want this for the next release, but it has been difficult to get anyone to review this. Maybe @ngnpope? |
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 think this looks good, just had 1 comment regarding show_error_codes
warn_unused_ignores = True | ||
warn_redundant_casts = True | ||
warn_unused_configs = True | ||
warn_unreachable = True | ||
disallow_untyped_defs = true | ||
disallow_incomplete_defs = true | ||
show_error_codes = False |
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.
Should we try to work towards show_error_codes = True
? It feels reasonable that tests are granular enough to fail if a specific error code changes.
It could be an option to try to resolve this over time. Best thing would probably be to have a linter that disallows type: ignore
i.e. without code in the test suite. I suppose that could be tracked in an issue.
Awesome, thanks!
For adding But in the It would make the already long |
Ah, right, didn't think about that it was the reverse case that was the issue. I suppose if we'd prefer matching on code instead of a complete message one could go with |
Sorry, I do want to help out, but I have to squeeze it in around everything else... 🙂 Me right now: 🤹🏻
I don't think that would work so well in most cases because the messages are often formatted with the type values which we then would not detect changes for... |
No worries :) |
Made a few tweaks that were needed to get our CI passing with mypy 0.991.
There is still a new regression withThanks to @flaeppe for the fix!mypy_django_plugin
that I haven't investigated, which happens with Django 3.2 only. Created an issue for it: #1261 Disabled testing with Django 2.2 and 3.2 in CI for now.