@@ -5,8 +5,8 @@ Error codes for optional checks
55
66This section documents various errors codes that mypy generates only
77if you enable certain options. See:ref: `error-codes ` for general
8- documentation about error codes. :ref: ` error-code-list ` documents
9- error codes that are enabled by default.
8+ documentation about error codes and their configuration.
9+ :ref: ` error-code-list ` documents error codes that are enabled by default.
1010
1111..note ::
1212
@@ -241,7 +241,7 @@ mypy generates an error if it thinks that an expression is redundant.
241241
242242..code-block ::python
243243
244- # Use " mypy -- enable-error-code redundant-expr ... "
244+ # mypy: enable-error-code=" redundant-expr"
245245
246246def example (x :int ) ->None :
247247# Error: Left operand of "and" is always true [redundant-expr]
@@ -268,7 +268,7 @@ example:
268268
269269..code-block ::python
270270
271- # Use " mypy -- enable-error-code possibly-undefined ... "
271+ # mypy: enable-error-code=" possibly-undefined"
272272
273273from typingimport Iterable
274274
@@ -297,7 +297,7 @@ Using an iterable value in a boolean context has a separate error code
297297
298298..code-block ::python
299299
300- # Use " mypy -- enable-error-code truthy-bool ... "
300+ # mypy: enable-error-code=" truthy-bool"
301301
302302class Foo :
303303pass
@@ -347,7 +347,7 @@ Example:
347347
348348..code-block ::python
349349
350- # Use " mypy -- enable-error-code ignore-without-code ... "
350+ # mypy: enable-error-code=" ignore-without-code"
351351
352352class Foo :
353353def __init__ (self ,name :str ) ->None :
@@ -378,7 +378,7 @@ Example:
378378
379379..code-block ::python
380380
381- # Use " mypy -- enable-error-code unused-awaitable ... "
381+ # mypy: enable-error-code=" unused-awaitable"
382382
383383import asyncio
384384
@@ -462,7 +462,7 @@ Example:
462462
463463..code-block ::python
464464
465- # Use " mypy -- enable-error-code explicit-override ... "
465+ # mypy: enable-error-code=" explicit-override"
466466
467467from typingimport override
468468
@@ -536,7 +536,7 @@ Now users can actually import ``reveal_type`` to make the runtime code safe.
536536
537537..code-block ::python
538538
539- # Use " mypy -- enable-error-code unimported-reveal"
539+ # mypy: enable-error-code=" unimported-reveal"
540540
541541 x= 1
542542 reveal_type(x)# Note: Revealed type is "builtins.int" \
@@ -546,7 +546,7 @@ Correct usage:
546546
547547..code-block ::python
548548
549- # Use " mypy -- enable-error-code unimported-reveal"
549+ # mypy: enable-error-code=" unimported-reveal"
550550from typingimport reveal_type# or `typing_extensions`
551551
552552 x= 1