Imagine we have some giant legacy code base with a lot of files with ignored Mypy warnings:
def foobar():
x = some_external_class.some_method()[0] # type: ignore[ignore-some-mypy-warning]
Time to go...
Some parts of code were changed. Some parts of code is still the same. How to check every "ignore" comment to know: will I get an error if I remove it?
Desired output:
Checked 100500 files!
You do not need "ignore" comments anymore in the following files:
- spam.py:534
- eggs.py:31
- eggs.py:250
Are there any existing tools to achieve this? Any ideas about custom scripts?
The only idea that I have:
From mypy documentation:
--warn-unused-ignores
This flag will make mypy report an error whenever your code uses a # type: ignore comment on a line that is not actually generating an error message.