mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Add support for enabling/disabling individual error codes

Open ofek opened this issue 6 years ago • 8 comments

From https://github.com/python/mypy/issues/7511#issuecomment-640665509

This would also entail giving a specific error code to most error messages

ofek avatar Jun 09 '20 06:06 ofek

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):

  1. How would we configure error codes (command line flag / config file option)?
  2. Should it be possible to set these on a per module basis? (Maybe initially these could be global flags, for simplicity.)
  3. Which additional error codes would be useful to add?
  4. Should some of the existing strictness flags be retrofitted to use this approach?
  5. 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.

JukkaL avatar Jun 09 '20 09:06 JukkaL

Can I start working on this?

b-thebest avatar Jun 27 '20 07:06 b-thebest

@b-thebest That would be awesome, yes please!

ofek avatar Jun 27 '20 13:06 ofek

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 avatar Jul 02 '20 11:07 jsar3004

@jsar3004 To get started, I'd recommend looking at https://github.com/python/mypy/blob/master/README.md and the linked documents.

JukkaL avatar Jul 03 '20 14:07 JukkaL

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

cph-w avatar Jul 21 '20 16:07 cph-w

@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 💯

m-vdb avatar Sep 02 '20 10:09 m-vdb

See #9290

hauntsaninja avatar Sep 02 '20 18:09 hauntsaninja