Add additional flags to mypy config and update type: ignore's#1248
Add additional flags to mypy config and update type: ignore's#1248DanielNoord merged 4 commits intopylint-dev:mainfrom
mypy config and update type: ignore's#1248Conversation
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
Smell like progress !
| no_implicit_optional = True | ||
| warn_redundant_casts = True | ||
| warn_unused_ignores = True | ||
| show_error_codes = True |
I think it's |
|
I don't think that requires you to specify the error you're ignoring in a |
|
Ho, sorry I misunderstood your question. I think this is not yet in mypy : python/mypy#11509 |
| """ | ||
| ) | ||
| match_mapping: nodes.MatchMapping = assign_stmts.pattern # type: ignore | ||
| match_mapping: nodes.MatchMapping = assign_stmts.pattern |
There was a problem hiding this comment.
The type: ignores here are only unused since the method isn't annotated and thus not type checked.
| scripts_are_modules = True | ||
| no_implicit_optional = True | ||
| warn_redundant_casts = True | ||
| warn_unused_ignores = True |
There was a problem hiding this comment.
I would remove warn_unused_ignores = True just for now. It isn't an issue at the moment. Instead it's more likely to cause false positives (see comment above). Other false-positives are the two type: ignores in rebuilder.py. They are only necessary in Python 3.9+, thus when checked with 3.8 they are marked as unnecessary.
There was a problem hiding this comment.
Look like mypy has the same problem than us for useless-suppression. We could mimic how they handle it ?
There was a problem hiding this comment.
Look like mypy has the same problem than us for useless-suppression. We could mimic how they handle it ?
We already do ;) They don't handle it.
There was a problem hiding this comment.
I mean they have an option to activate it or not with warn_unused_ignores = True, like we do when we enable useless-suppression, but do you know how they handle discrepancies that appear between python interpreter when unused ignores are activated ?
There was a problem hiding this comment.
If the code is evaluated, they emit an error. I.e. not if it's guarded behind a if sys.version_info check what is quite common when using typing.
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Steps
Description
@cdce8p I think these are the flags we can turn on right now without much trouble.
I also added an error code to every single
type: ignorecurrently in the code.I couldn't find anything about it online, but do you know if there is a way to require error codes in these ignore messages?
Type of Changes
Related Issue