mypy
mypy copied to clipboard
Request: equivalent CLI option to `ruff`'s `--add-noqa` to add `type: ignore` comments
Feature
ruff has an --add-noqa option to add noqa directives in all places: https://docs.astral.sh/ruff/linter/#inserting-necessary-suppression-comments
It would nice if mypy had something similar, like a --add-ignore CLI argument
Pitch
This would enable a new route to adopt mypy, mainly suppressing all type errors with type: ignore comments, and slowly removing them over time.
Turns out there are two third party projects for this:
- https://github.com/ugognw/mypy-upgrade
- https://github.com/geo7/mypy_clean_slate
I tried using both of them today (2/6/2024), and they sort of work, but they both have bugs (e.g. not in sync with mypy latest release, broken by pretty = true, don't add error codes to type ignores, can add duplicate codes).
Imo it would be great to have this capability directly supported within mypy