Skip to content
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

Add support for enabling/disabling individual error codes #8975

Closed
ofek opened this issue Jun 9, 2020 · 8 comments · Fixed by #9172
Closed

Add support for enabling/disabling individual error codes #8975

ofek opened this issue Jun 9, 2020 · 8 comments · Fixed by #9172

Comments

@ofek
Copy link

ofek commented Jun 9, 2020

From #7511 (comment)

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

@JukkaL
Copy link
Collaborator

JukkaL commented Jun 9, 2020

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.

@b-thebest
Copy link

Can I start working on this?

@ofek
Copy link
Author

ofek commented Jun 27, 2020

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

@jsar3004
Copy link

jsar3004 commented Jul 2, 2020

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.

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 3, 2020

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

@cph-w
Copy link
Contributor

cph-w commented Jul 21, 2020

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 pushed a commit that referenced this issue Aug 10, 2020
Add ability to enable error codes globally from the command line
Add ability to disable error codes globally from the command line
Enabling error codes will always override disabling error codes
Update documentation to include new flags

Fixes #8975.
@m-vdb
Copy link

m-vdb commented Sep 2, 2020

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

@hauntsaninja
Copy link
Collaborator

See #9290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants