Skip to content

Commit

Permalink
Add documentation for show-error-code-links (#17144)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
GiorgosPapoutsakis and pre-commit-ci[bot] committed May 30, 2024
1 parent 0820e95 commit 77cfb98
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions docs/source/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 77cfb98

Please sign in to comment.