Add support for enabling/disabling individual error codes
From https://github.com/python/mypy/issues/7511#issuecomment-640665509
This would also entail giving a specific error code to most error messages
Mypy can already produce error codes for many of the most common errors (--show-error-codes). We'd probably want to add some more error codes for messages that would be good candidates for disabling (or enabling), however.
#7599 is very closely related, but it's a slightly different use case, so let's keep both issues open.
Open questions (we only need to resolve the first one before implementation work can start):
- How would we configure error codes (command line flag / config file option)?
- Should it be possible to set these on a per module basis? (Maybe initially these could be global flags, for simplicity.)
- Which additional error codes would be useful to add?
- Should some of the existing strictness flags be retrofitted to use this approach?
- Should we also display error codes by default, as otherwise the feature may be confusing to use?
Brainstorming for (1): We could call the options --enable-error-code code and --disable-error-code code (these can be repeated, similar to --always-true). In the config file this could be disable_error_code = code1, code2, ..., etc.
Can I start working on this?
@b-thebest That would be awesome, yes please!
I am new to open source. I want to work on this issue. Please tell how can I fix this issue or what technologies should I learn to fix this issue.
@jsar3004 To get started, I'd recommend looking at https://github.com/python/mypy/blob/master/README.md and the linked documents.
Hi @JukkaL, I took a first crack at this in the linked MR. Please let me know if you have any feedback or additional work to be completed for this based on that implementation
@JukkaL hi! is it possible to have a mypy release on pypi that includes this change? I'd love to use it 😄
And thanks a lot @cph-w for making it 💯
See #9290