From bab21463385436348a1025b195afc2700e61f8cd Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Wed, 1 Nov 2023 00:08:26 +0000 Subject: [PATCH 1/2] Don't show docs links for plugin error codes --- mypy/errorcodes.py | 3 +++ mypy/errors.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) 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..1994135b34a6 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 in mypy_error_codes ): message = f"See {BASE_RTD_URL}-{info.code.code} for more info" if message in self.only_once_messages: From bec4eaac09e0ace3d52825f97f98e67e76db51ac Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Wed, 1 Nov 2023 00:13:37 +0000 Subject: [PATCH 2/2] Fix if --- mypy/errors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/errors.py b/mypy/errors.py index 1994135b34a6..6e90c28d9c03 100644 --- a/mypy/errors.py +++ b/mypy/errors.py @@ -560,7 +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 in mypy_error_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: