Skip to content

Commit 6f39906

Browse files
committed
Tweak error message to avoid misleading the user
Users who turn ignore-without-code on are likely at first to encounter cases where their existing ignores are too broad. The previous hint spelling was useful, however could encourage users to just ignore everything which was already ignored rather than actually reviewing the code. This change removes the implication that the correct course is to blindly update the ignore comment while still containing the useful information about what is ignored.
1 parent 223da4b commit 6f39906

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mypy/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def generate_ignore_without_code_errors(self,
511511
codes_hint = ''
512512
ignored_codes = used_ignored_lines[line]
513513
if ignored_codes:
514-
codes_hint = f' (hint: add [{", ".join(ignored_codes)}])'
514+
codes_hint = f' (currently ignored: [{", ".join(ignored_codes)}])'
515515

516516
message = f'"type: ignore" comment without error code{codes_hint}'
517517
# Don't use report since add_error_info will ignore the error!

test-data/unit/check-errorcodes.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ x # type: ignore[name-defined, attr-defined] # E: Unused "type: ignore[attr-defi
138138
[case testErrorCodeMissingWhenRequired]
139139
# flags: --enable-error-code ignore-without-code
140140
"x" # type: ignore # E: "type: ignore" comment without error code [ignore-without-code]
141-
y # type: ignore # E: "type: ignore" comment without error code (hint: add [name-defined]) [ignore-without-code]
141+
y # type: ignore # E: "type: ignore" comment without error code (currently ignored: [name-defined]) [ignore-without-code]
142142
z # type: ignore[name-defined]
143143
"a" # type: ignore[ignore-without-code]
144144

0 commit comments

Comments
 (0)