mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Add a "report only" config option, controllable by module / path

Open shevron opened this issue 4 years ago • 1 comments

Feature

Add the ability to make mypy report errors but not fail (that is, not exit with a non-zero code), and make that ability controllable by module / path. This is different from setting ignore_errors = True, because that does not show errors / warnings.

Pitch

For large / legacy projects gradually adding type annotations, it can be very beneficial to enforce strict type checking on newer / ported code, but not fail CI because older / unported code still doesn't pass mypy checks. Having visiblity into issues in the existing code without failing, but strict checking of newer code, allows for this gradual adaptation model.

I realize this can be achieved by wrapping mypy in a script / Makefile and running it with mypy my/legacy/module || true wrappers, but that is cumbersome especially for a large codebase. Having the ability to control this via mypy.ini would be much more natural and fine grained.

I believe many other tools offer similar flags.

shevron avatar Sep 12 '21 18:09 shevron

It would be great to have this. For instance pylint have https://pylint.pycqa.org/en/latest/user_guide/configuration/all-options.html#exit-zero

It seems a duplicate request was closed here : https://github.com/python/mypy/issues/15051

nkpf42 avatar Jun 27 '23 09:06 nkpf42

Closing as per https://github.com/python/mypy/issues/15051#issuecomment-1507454694

hauntsaninja avatar Jun 21 '24 09:06 hauntsaninja