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

ErrorCodes defined in mypy plugins seemingly cannot be ignored by --disable-error-code #12987

Open
aleksanb opened this issue Jun 16, 2022 · 0 comments · May be fixed by #13419
Open

ErrorCodes defined in mypy plugins seemingly cannot be ignored by --disable-error-code #12987

aleksanb opened this issue Jun 16, 2022 · 0 comments · May be fixed by #13419
Labels
bug mypy got something wrong topic-configuration Configuration files and flags topic-plugins The plugin API and ideas for new plugins

Comments

@aleksanb
Copy link
Contributor

aleksanb commented Jun 16, 2022

It seems like errors registered in plugins are unignoreable by mypy, as in the following case from the django-stubs plugin for mypy for analyzing django code: typeddjango/django-stubs#993.

We have some custom error codes declared like this:

and presumably mypy checks the list of errors here:

valid_error_codes = set(error_codes.keys())
before initializing plugins, so our custom errors haven't ended up in error_codes before we check them.

Any suggestions for workarounds or fixes?

@aleksanb aleksanb added the bug mypy got something wrong label Jun 16, 2022
@AlexWaygood AlexWaygood added topic-plugins The plugin API and ideas for new plugins topic-configuration Configuration files and flags labels Jun 16, 2022
PIG208 added a commit to PIG208/django-stubs that referenced this issue Aug 5, 2022
Since mypy does not support suppressing errors with custom error codes
yet, this is a temporary workaround to allow people to type ignore the
error with the `misc` error code.

TODO:
Use the custom error code when python/mypy#12987 is fixed.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
PIG208 added a commit to PIG208/django-stubs that referenced this issue Aug 5, 2022
Since mypy does not support suppressing errors with custom error codes
yet, this is a temporary workaround to allow people to type ignore the
error with the `misc` error code.

TODO:
Use the custom error code when python/mypy#12987 is fixed.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
PIG208 added a commit to PIG208/django-stubs that referenced this issue Aug 8, 2022
Since mypy does not support suppressing errors with custom error codes
yet, this is a temporary workaround to allow people to type ignore the
error with the `misc` error code.

TODO:
Use the custom error code when python/mypy#12987 is fixed.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
PIG208 added a commit to PIG208/django-stubs that referenced this issue Aug 8, 2022
Since mypy does not support suppressing errors with custom error codes
yet, this is a temporary workaround to allow people to type ignore the
error with the `misc` error code.

TODO:
Use the custom error code when python/mypy#12987 is fixed.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
tik-stbuehler added a commit to tik-stbuehler/mypy that referenced this issue Aug 15, 2022
Fixes python#12987

* Ignore unknown error codes in process_options
* Reload enabled / disabled error codes after loading plugins
* Unknown errors codes no longer a hard failure, they only get logged to
  stderr
@tik-stbuehler tik-stbuehler linked a pull request Aug 15, 2022 that will close this issue
scottp-dpaw pushed a commit to scottp-dpaw/mypy that referenced this issue Oct 17, 2022
Fixes python#12987

* Ignore unknown error codes in process_options
* Reload enabled / disabled error codes after loading plugins
* Unknown errors codes no longer a hard failure, they only get logged to
  stderr
scottp-dpaw pushed a commit to scottp-dpaw/mypy that referenced this issue Oct 17, 2022
Fixes python#12987

* Ignore unknown error codes in process_options
* Reload enabled / disabled error codes after loading plugins
* Unknown errors codes no longer a hard failure, they only get logged to
  stderr
scottp-dpaw pushed a commit to scottp-dpaw/mypy that referenced this issue Jan 13, 2023
Fixes python#12987

* Ignore unknown error codes in process_options
* Reload enabled / disabled error codes after loading plugins
* Unknown errors codes no longer a hard failure, they only get logged to
  stderr
scottp-dpaw pushed a commit to scottp-dpaw/mypy that referenced this issue Feb 21, 2023
Fixes python#12987

* Ignore unknown error codes in process_options
* Reload enabled / disabled error codes after loading plugins
* Unknown errors codes no longer a hard failure, they only get logged to
  stderr
scottp-dpaw pushed a commit to scottp-dpaw/mypy that referenced this issue Oct 3, 2023
Fixes python#12987

* Ignore unknown error codes in process_options
* Reload enabled / disabled error codes after loading plugins
* Unknown errors codes no longer a hard failure, they only get logged to
  stderr
scottp-dpaw pushed a commit to scottp-dpaw/mypy that referenced this issue Oct 3, 2023
Fixes python#12987

* Ignore unknown error codes in process_options
* Reload enabled / disabled error codes after loading plugins
* Unknown errors codes no longer a hard failure, they only get logged to
  stderr
scottp-dpaw pushed a commit to scottp-dpaw/mypy that referenced this issue Mar 6, 2024
Fixes python#12987

* Ignore unknown error codes in process_options
* Reload enabled / disabled error codes after loading plugins
* Unknown errors codes no longer a hard failure, they only get logged to
  stderr
scottp-dpaw pushed a commit to scottp-dpaw/mypy that referenced this issue Mar 6, 2024
Fixes python#12987

* Ignore unknown error codes in process_options
* Reload enabled / disabled error codes after loading plugins
* Unknown errors codes no longer a hard failure, they only get logged to
  stderr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-configuration Configuration files and flags topic-plugins The plugin API and ideas for new plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants