Skip to content

Commit

Permalink
Don't show docs links for plugin error codes (#16383)
Browse files Browse the repository at this point in the history
Fixes #16375
  • Loading branch information
ilevkivskyi committed Nov 1, 2023
1 parent 4291b2c commit 14f79c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions mypy/errorcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 2 additions & 1 deletion mypy/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 14f79c1

Please sign in to comment.