From b84c3d02dfde691a4ec223d3ea6ec0522f176150 Mon Sep 17 00:00:00 2001 From: Varun Chawla Date: Sat, 7 Feb 2026 21:52:07 -0800 Subject: [PATCH] Document show_error_codes config option and CLI flag Fixes #17083 Both the config file and command line documentation were missing documentation for show_error_codes, which is the default behavior (error codes are shown by default). Added documentation for: - show_error_codes in config_file.rst (as the default True option) - --show-error-codes in command_line.rst (as the default behavior) This makes it clear that error codes are shown by default and that users can use either show_error_codes=True or hide_error_codes=False in the config file, and either --show-error-codes or --no-hide-error-codes on the command line. --- docs/source/command_line.rst | 9 +++++++++ docs/source/config_file.rst | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index b5081f113f917..f24d390608790 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -924,6 +924,15 @@ in error messages. ``file:line:column:end_line:end_column``. This option implies ``--show-column-numbers``. +.. option:: --show-error-codes + + This flag will show the error code ``[]`` after each error message. This is the + default behavior:: + + prog.py:1: error: "str" has no attribute "trim" [attr-defined] + + See :ref:`error-codes` for more information. + .. option:: --hide-error-codes This flag will hide the error code ``[]`` from error messages. By default, the error diff --git a/docs/source/config_file.rst b/docs/source/config_file.rst index 77f9524710075..4ebf46b7d3d87 100644 --- a/docs/source/config_file.rst +++ b/docs/source/config_file.rst @@ -894,6 +894,15 @@ These options may only be set in the global section (``[mypy]``). Shows documentation link to corresponding error code. +.. confval:: show_error_codes + + :type: boolean + :default: True + + Shows error codes in error messages. See :ref:`error-codes` for more information. + + This is the default behavior. To hide error codes, use :confval:`hide_error_codes` instead. + .. confval:: hide_error_codes :type: boolean