From 9d07eb7de6c117b4bd47043bde31f4e10625285e Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 19 Feb 2022 23:24:08 +0100 Subject: [PATCH] Update ignore-without-code message --- docs/source/error_code_list2.rst | 2 +- mypy/errors.py | 2 +- test-data/unit/check-errorcodes.test | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/error_code_list2.rst b/docs/source/error_code_list2.rst index f9c9a64071d17..c55643ad6181e 100644 --- a/docs/source/error_code_list2.rst +++ b/docs/source/error_code_list2.rst @@ -282,7 +282,7 @@ Example: # - the expected error 'assignment', and # - the unexpected error 'attr-defined' # are silenced. - # Error: "type: ignore" comment without error code (use "type: ignore[attr-defined]" instead) + # Error: "type: ignore" comment without error code (consider "type: ignore[attr-defined]" instead) f.nme = 42 # type: ignore # This line warns correctly about the typo in the attribute name diff --git a/mypy/errors.py b/mypy/errors.py index 62e82048e964b..60abb739ba847 100644 --- a/mypy/errors.py +++ b/mypy/errors.py @@ -534,7 +534,7 @@ def generate_ignore_without_code_errors(self, codes_hint = '' ignored_codes = sorted(set(used_ignored_lines[line])) if ignored_codes: - codes_hint = f' (use "type: ignore[{", ".join(ignored_codes)}]" instead)' + codes_hint = f' (consider "type: ignore[{", ".join(ignored_codes)}]" instead)' message = f'"type: ignore" comment without error code{codes_hint}' # Don't use report since add_error_info will ignore the error! diff --git a/test-data/unit/check-errorcodes.test b/test-data/unit/check-errorcodes.test index 3c85ae48bb29a..a74771108ca20 100644 --- a/test-data/unit/check-errorcodes.test +++ b/test-data/unit/check-errorcodes.test @@ -148,7 +148,7 @@ x # type: ignore[name-defined, attr-defined] # E: Unused "type: ignore[attr-defi [case testErrorCodeMissingWhenRequired] # flags: --enable-error-code ignore-without-code "x" # type: ignore # E: "type: ignore" comment without error code [ignore-without-code] -y # type: ignore # E: "type: ignore" comment without error code (use "type: ignore[name-defined]" instead) [ignore-without-code] +y # type: ignore # E: "type: ignore" comment without error code (consider "type: ignore[name-defined]" instead) [ignore-without-code] z # type: ignore[name-defined] "a" # type: ignore[ignore-without-code] @@ -173,7 +173,7 @@ class A: a: A | None # 'union-attr' should only be listed once (instead of twice) and list should be sorted -a.func("invalid string").attr # type: ignore # E: "type: ignore" comment without error code (use "type: ignore[arg-type, union-attr]" instead) [ignore-without-code] +a.func("invalid string").attr # type: ignore # E: "type: ignore" comment without error code (consider "type: ignore[arg-type, union-attr]" instead) [ignore-without-code] [builtins fixtures/tuple.pyi] [case testErrorCodeIgnoreWithExtraSpace]