Skip to content

Conversation

@tik-stbuehler
Copy link

Description

Fixes #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
    (I copied this from the way warn_unused_configs is handled, and I don't think parser errors can be triggered after plugins were loaded?)

Duplicating the code seems a bit ugly, but the way the Errors instance is created before loading the plugins I'm not quite sure what the implications would be if the error code loading is delayed completely.
(Another thing I noticed: the Errors constructor creates new sets when passed empty sets, but shares non-empty sets otherwise. That seems bad - probably should either share always or clone always.)

Test Plan

No idea how to test plugins.

I used this manually (and successfully) by having something like this in pyproject.toml in a project using django:

[tool.mypy]
plugins = [
    "mypy_django_plugin.main",
]
disable_error_code = [
    "django-manager-missing",
]

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
@github-actions

This comment has been minimized.

@mannyanebi
Copy link

mannyanebi commented Aug 31, 2022

Following up to see where this PR leads. Having issues with supressing django-manager-missing

@scottp-dpaw
Copy link

Just wanted to say thank you for this patchset, am also experiencing this issue in trying to suppress django-manager-missing.

@scottp-dpaw
Copy link

Also there's an additional error code validator in the config parser, I would suggest removing it so that pyproject.toml works - scottp-dpaw@4fe7aeb

@karamanolev
Copy link

Are there any news on this? I'm also on the bandwagon trying to suppress django-manager-missing from django-stubs and failing. @tik-stbuehler thanks for opening this, anything I can do to get it in?

@JelleZijlstra
Copy link
Member

I can take a look when CI is green.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@scottp-dpaw
Copy link

I rebased the changes on the latest master in https://github.com/scottp-dpaw/mypy/tree/v1.8.0_fixes

@tbrlpld
Copy link

tbrlpld commented Jun 13, 2025

Running into the django-manager-missing issue as well.

@ilevkivskyi
Copy link
Member

Superseded by #19719

@ilevkivskyi ilevkivskyi closed this Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

7 participants