-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Feature
As far as I know, there's no way to enforce an error code is added to the end of a type ignore. Since error codes can narrow the type errors ignored on a specific line, it would be useful to ensure all # type: ignores in a codebase included an error code, to avoid silencing additional errors or disabling otherwise valid typechecking on a line.
The feature could be a config option --enforce-error-codes
that verifies all type: ignores specify an error code.
x: int = None # type: ignore <- mypy complains
x: int = None # type: ignore[assignment] <- good!
huonw