-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to ignore type: ignore
, disabled error codes
#13201
Comments
There is |
And all parts of code matter for mypy (unlike flake8). So, I don't think we need such a flag: un-silencing errors in this case can bring very confusing results. |
@sobolevn, what do you mean that "it also changes types of things"? My understanding is that mypy simply suppresses any errors on a line with a FWIW, pyright has an option that does what @copdips is requesting here (`"enableTypeIgnoreComments": false) to accommodate this use case. |
@erictraut, flake8
flake8 --disable-noqa --exit-zero The first one is for the real CI check, and the second one is just for the review/audit. |
@erictraut is correct, a If you know which code is type checked by mypy, it's easy enough to use some grep-like tool to find type ignores, for example something like this:
This doesn't show the errors that are ignored, however. As a quick hack, you could use sed to temporarily replace, say, |
flake8 --disable-noqa
type: ignore
type: ignore
type: ignore
, disabled error codes
I am in a conundrum because the I do have a file that might be missing: try:
from ._version import version as __version__ # type: ignore
except ImportError: # pragma: no cover
__version__ = "0.1.dev1" Once mypy is configured to detect unused ignores (useful feature), I cannot make it really ignore this line. Keep in mind that there are two cases here, one where the file exists and one where the file does not exist. I want to ensure mypy does not annoy me about this particular line only. |
@ssbarnea your issue is unrelated to the feature request here, I think it's more related to #15164 which should fix your kind of thing (will be included in next release). In particular, see this test case . For now, you can likely hack around it using |
Feature
My goal is to check all the ignored
inline
mypy errors/warningsPitch
People often added inline comment
# type: ignore
to ignore mypy error for a specific line, but it's difficult to trace for other developers, or for audit purpose. Now I would like to have something similar toflake8 --disable-noqa
, which show all the mypy errors/warnings regardless of these inline ignores.The text was updated successfully, but these errors were encountered: