Skip to content

support custom error codes in options check #19953

Closed as duplicate
Closed as duplicate

Description

@belm0

Feature
mypy options check should recognize custom error codes defined in plugins

Pitch
We have a number of custom mypy checks and would like them to have distinct error codes, allowing them to be reported / ignored / enabled / disabled just as built in errors.

mypy appears to mostly support custom error codes defined by a plugin, since the ErrorCode constructor registers with the global collection of errors, and everything operates as expected (reporting, using type: ignore[], and disabling... but see below).

The problem comes up when referring to custom errors codes in options, triggering Invalid error code(s):

  • on command line with --disable-error-code, etc.: fails outright with non-zero code
  • in pyproject.toml disable_error_code etc.: outputs a warning but does not cause non-zero exit, and the reference is properly honored

I believe this can be rectified by deferring the error code check until after plugins are loaded, but realize that may be tricky to implement.

Activity

  1. ilevkivskyi commented on Sep 29, 2025

    @ilevkivskyi
    Member

    I think this is essentially a duplicate of #12987

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions