Skip to content

Commit 77cfb98

Browse files
Add documentation for show-error-code-links (#17144)
This PR closes issue #16693 and a part of issue #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>
1 parent 0820e95 commit 77cfb98

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs/source/command_line.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,17 @@ in error messages.
747747

748748
main.py:12:9: error: Unsupported operand types for / ("int" and "str")
749749

750+
.. option:: --show-error-code-links
751+
752+
This flag will also display a link to error code documentation, anchored to the error code reported by mypy.
753+
The corresponding error code will be highlighted within the documentation page.
754+
If we enable this flag, the error message now looks like this::
755+
756+
main.py:3: error: Unsupported operand types for - ("int" and "str") [operator]
757+
main.py:3: note: See 'https://mypy.rtfd.io/en/stable/_refs.html#code-operator' for more info
758+
759+
760+
750761
.. option:: --show-error-end
751762

752763
This flag will make mypy show not just that start position where

docs/source/config_file.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,13 @@ These options may only be set in the global section (``[mypy]``).
787787

788788
Shows column numbers in error messages.
789789

790+
.. confval:: show_error_code_links
791+
792+
:type: boolean
793+
:default: False
794+
795+
Shows documentation link to corresponding error code.
796+
790797
.. confval:: hide_error_codes
791798

792799
:type: boolean

0 commit comments

Comments
 (0)