diff --git a/mypy/errorcodes.py b/mypy/errorcodes.py index 98600679da53..c6e9de9f31c1 100644 --- a/mypy/errorcodes.py +++ b/mypy/errorcodes.py @@ -274,3 +274,6 @@ def __hash__(self) -> int: "General", sub_code_of=MISC, ) + +# This copy will not include any error codes defined later in the plugins. +mypy_error_codes = error_codes.copy() diff --git a/mypy/errors.py b/mypy/errors.py index 4e62a48aeb27..6e90c28d9c03 100644 --- a/mypy/errors.py +++ b/mypy/errors.py @@ -8,7 +8,7 @@ from typing_extensions import Literal, TypeAlias as _TypeAlias from mypy import errorcodes as codes -from mypy.errorcodes import IMPORT, IMPORT_NOT_FOUND, IMPORT_UNTYPED, ErrorCode +from mypy.errorcodes import IMPORT, IMPORT_NOT_FOUND, IMPORT_UNTYPED, ErrorCode, mypy_error_codes from mypy.message_registry import ErrorMessage from mypy.options import Options from mypy.scope import Scope @@ -560,6 +560,7 @@ def add_error_info(self, info: ErrorInfo) -> None: and not self.options.hide_error_codes and info.code is not None and info.code not in HIDE_LINK_CODES + and info.code.code in mypy_error_codes ): message = f"See {BASE_RTD_URL}-{info.code.code} for more info" if message in self.only_once_messages: