From 77cfb9887c8f2bba2443196d7462a027f435450f Mon Sep 17 00:00:00 2001 From: GiorgosPapoutsakis <116210016+GiorgosPapoutsakis@users.noreply.github.com> Date: Thu, 30 May 2024 23:37:14 +0300 Subject: [PATCH] Add documentation for show-error-code-links (#17144) This PR closes issue https://github.com/python/mypy/issues/16693 and a part of issue https://github.com/python/mypy/issues/17083 Propositional documentation updates for show-error-code-links, which update files command_line.rst and config_file.rst. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- docs/source/command_line.rst | 11 +++++++++++ docs/source/config_file.rst | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index 4a7ead3e8724..50a6ef65f4d0 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -747,6 +747,17 @@ in error messages. main.py:12:9: error: Unsupported operand types for / ("int" and "str") +.. option:: --show-error-code-links + + This flag will also display a link to error code documentation, anchored to the error code reported by mypy. + The corresponding error code will be highlighted within the documentation page. + If we enable this flag, the error message now looks like this:: + + main.py:3: error: Unsupported operand types for - ("int" and "str") [operator] + main.py:3: note: See 'https://mypy.rtfd.io/en/stable/_refs.html#code-operator' for more info + + + .. option:: --show-error-end This flag will make mypy show not just that start position where diff --git a/docs/source/config_file.rst b/docs/source/config_file.rst index ac110cbed9f1..b0e82a33255a 100644 --- a/docs/source/config_file.rst +++ b/docs/source/config_file.rst @@ -787,6 +787,13 @@ These options may only be set in the global section (``[mypy]``). Shows column numbers in error messages. +.. confval:: show_error_code_links + + :type: boolean + :default: False + + Shows documentation link to corresponding error code. + .. confval:: hide_error_codes :type: boolean