From 2770774e513cef2b89cb2d71431afc0cb1418f06 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 25 Sep 2025 05:18:36 +0700 Subject: [PATCH 1/2] document how overbroad codes count as unused ignore I've probably messed up the rst links, because the format is very confusing. --- docs/source/error_code_list2.rst | 2 ++ docs/source/error_codes.rst | 1 + 2 files changed, 3 insertions(+) diff --git a/docs/source/error_code_list2.rst b/docs/source/error_code_list2.rst index bd2436061974..58de6c96b8ee 100644 --- a/docs/source/error_code_list2.rst +++ b/docs/source/error_code_list2.rst @@ -506,6 +506,8 @@ Example: # Python 3.8, or Python 3.9 42 + "testing..." # type: ignore +If a narrower code is ignored by specifying a wider code, this counts as an instance of unused-ignore. (The wider code is, conceptually, partially unused.) For more information about the concepts of codes that contain each other, see :ref:`subcodes-of-error-codes`. + .. _code-explicit-override: Check that ``@override`` is used when overriding a base class method [explicit-override] diff --git a/docs/source/error_codes.rst b/docs/source/error_codes.rst index 485d70cb59bc..f3ef4d23d3b4 100644 --- a/docs/source/error_codes.rst +++ b/docs/source/error_codes.rst @@ -110,6 +110,7 @@ is a subcode of another one, it will be mentioned in the documentation for the n code. This hierarchy is not nested: there cannot be subcodes of other subcodes. +If a narrower code is ignored by specifying a wider code, this counts as an instance of :ref:`unused-ignore`. (The wider code is, conceptually, partially unused.) Requiring error codes --------------------- From c2a7a5ceb9d13e865a546a7780364279b37a03f2 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Fri, 10 Oct 2025 17:27:26 -0700 Subject: [PATCH 2/2] correct refs, and also rephrase --- docs/source/error_code_list2.rst | 4 +++- docs/source/error_codes.rst | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/source/error_code_list2.rst b/docs/source/error_code_list2.rst index 58de6c96b8ee..8e850a52c7fb 100644 --- a/docs/source/error_code_list2.rst +++ b/docs/source/error_code_list2.rst @@ -506,7 +506,9 @@ Example: # Python 3.8, or Python 3.9 42 + "testing..." # type: ignore -If a narrower code is ignored by specifying a wider code, this counts as an instance of unused-ignore. (The wider code is, conceptually, partially unused.) For more information about the concepts of codes that contain each other, see :ref:`subcodes-of-error-codes`. +If a narrower code (a subcode) is ignored by specifying a wider code, this counts +as an instance of unused-ignore. (The wider code is, conceptually, partially unused.) +For more information about subcodes, see :ref:`subcodes-of-error-codes`. .. _code-explicit-override: diff --git a/docs/source/error_codes.rst b/docs/source/error_codes.rst index f3ef4d23d3b4..d9bb3ee68d06 100644 --- a/docs/source/error_codes.rst +++ b/docs/source/error_codes.rst @@ -99,6 +99,8 @@ So one can e.g. enable some code globally, disable it for all tests in the corresponding config section, and then re-enable it with an inline comment in some specific test. +.. _subcodes-of-error-codes: + Subcodes of error codes ----------------------- @@ -110,7 +112,9 @@ is a subcode of another one, it will be mentioned in the documentation for the n code. This hierarchy is not nested: there cannot be subcodes of other subcodes. -If a narrower code is ignored by specifying a wider code, this counts as an instance of :ref:`unused-ignore`. (The wider code is, conceptually, partially unused.) +If a narrower code is ignored by specifying a wider code, this counts as an instance of +:ref:`unused-ignore`. (The wider code is, conceptually, partially +unused.) Requiring error codes ---------------------