-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Labels
suppressionRelated to supression of violations e.g. ty:ignoreRelated to supression of violations e.g. ty:ignore
Milestone
Description
astral-sh/ruff#17305 revealed an interesting case where Red Knot raised an unused suppression diagnostic when the user intended to suppress it:
text_encoding = (
io.text_encoding # type: ignore[unused-ignore, attr-defined]
if sys.version_info > (3, 10)
else _text_encoding
)Source: https://github.com/jaraco/zipp/blob/main/zipp/compat/py310.py
type: ignore currently acts as a wildcard suppression (we disregard anything coming in [...]) and suppresses anything except unused suppression issues. The result is that users aren't able to suppress unused suppression diagnostics with type: ignore and are forced to use a red knot specific suppression instead.
Different options are:
- Change
type: ignoreto suppress all diagnostics (including unused suppression) - Accept that users have to use a red knot specific suppression for unused suppression diagnostics (this is what Ruff does)
- Add support for
type: ignore[unused-ignore] - ..?
edgarrmondragon
Metadata
Metadata
Assignees
Labels
suppressionRelated to supression of violations e.g. ty:ignoreRelated to supression of violations e.g. ty:ignore