mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Request: equivalent CLI option to `ruff`'s `--add-noqa` to add `type: ignore` comments

Open jamesbraza opened this issue 7 months ago • 1 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.

jamesbraza avatar Jan 06 '24 03:01 jamesbraza

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

jamesbraza avatar Feb 06 '24 21:02 jamesbraza