@@ -43,11 +43,7 @@ Silencing errors based on error codes
4343You can use a special comment ``# type: ignore[code, ...] `` to only
4444ignore errors with a specific error code (or codes) on a particular
4545line. This can be used even if you have not configured mypy to show
46- error codes. Currently it's only possible to disable arbitrary error
47- codes on individual lines using this comment.
48-
49- You can also use :option: `--disable-error-code <mypy --disable-error-code> `
50- to disable specific error codes globally.
46+ error codes.
5147
5248This example shows how to ignore an error about an imported name mypy
5349thinks is undefined:
@@ -58,17 +54,17 @@ thinks is undefined:
5854 # definition.
5955 from foolib import foo # type: ignore [ attr -defined ]
6056
61-
62- Enabling specific error codes
63- -----------------------------
57+ Enabling/disabling specific error codes globally
58+ ------------------------------------------------
6459
6560There are command-line flags and config file settings for enabling
6661certain optional error codes, such as :option: `--disallow-untyped-defs <mypy --disallow-untyped-defs> `,
6762which enables the ``no-untyped-def `` error code.
6863
69- You can use :option: `--enable-error-code <mypy --enable-error-code> ` to
70- enable specific error codes that don't have a dedicated command-line
71- flag or config file setting.
64+ You can use :option: `--enable-error-code <mypy --enable-error-code> `
65+ and :option: `--disable-error-code <mypy --disable-error-code> `
66+ to enable or disable specific error codes that don't have a dedicated
67+ command-line flag or config file setting.
7268
7369Per-module enabling/disabling error codes
7470-----------------------------------------
@@ -107,8 +103,9 @@ still keep the other two error codes enabled. The overall logic is following:
107103
108104* Individual config sections *adjust * them per glob/module
109105
110- * Inline ``# mypy: ... `` comments can further *adjust * them for a specific
111- module
106+ * Inline ``# mypy: disable-error-code="..." `` comments can further
107+ *adjust * them for a specific module.
108+ For example: ``# mypy: disable-error-code="truthy-bool, ignore-without-code" ``
112109
113110So one can e.g. enable some code globally, disable it for all tests in
114111the corresponding config section, and then re-enable it with an inline
0 commit comments