8000 Disable specific checks · Issue #3806 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Disable specific checks #3806

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

Closed
AmatanHead opened this issue Aug 7, 2017 · 6 comments
Closed

Disable specific checks #3806

AmatanHead opened this issue Aug 7, 2017 · 6 comments

Comments

@AmatanHead
Copy link

Hello!

I've tried to run mypy on my project and I've got, among others, lots of 'Need type annotation for variable' errors. Since I'm not quiet ready to annotate all of those, I'd like to disable this kind of errors. Any way to do it? If no, let this issue be a feature request.

@carljm
Copy link
Member
carljm commented Aug 7, 2017

I don't think this is currently possible, and I think the feature request is effectively what's described in the comment on #3507 -- a "loose mode" that tries hard to never issue any error on non-annotated code.

@AmatanHead
Copy link
Author

never issue any error on non-annotated code.

Well, that's may be not enough. For example, my code is annotated and checked by PyCharm, which report no errors. Trying to run mypy on this code yields a lot of errors that may seem false-positive to me (but no to the other users). I'd also like the ability to turn off a check temporarily if there is a bug in this check. So something more flexible than just not reporting errors in a not typed code is needed.

@emmatyping
Copy link
Member
emmatyping commented Aug 7, 2017

For example, my code is annotated and checked by PyCharm, which report no errors.

PyCharm and Mypy have different levels of strictness in many things such as untyped collections and Unions, Pycharm is in general less strict (which is good for an IDE, less so for a tool meant to find bugs in programs).

Also, have you used # type: ignore comments? It should help in some cases where you want the type checker to ignore complex things, or where it makes a mistake. Other situations should be handled by flags.

So something more flexible than just not reporting errors in a not typed code is needed.

I don't think Carl meant that, and if you read #3507, you will see that the proposed solution Any's eg collection items, so that those will not be errors, and the type system in general becomes less strict. It is more complex than simply suppressing errors, it actually relaxes the type checks, which as a major side effect, does not report errors on untyped collections.

@ilevkivskyi
Copy link
Member

I think it was already proposed to assign a unique number for every error message (like in flake8), but I can't fund an issue (maybe this was on gitter). I think this is a reasonable feature request, but rather low priority at the moment, since mypy is still in alpha stage and many things can change.

@JukkaL
Copy link
Collaborator
JukkaL commented Aug 8, 2017

Implementing unique error codes for every error message is probably too big of a change to happen in the near future. A "loose" mode would be more promising as a shorter-term fix to the issue, as discussed in #3507. I've been thinking about such a mode for a long time (at one point it was called the "weak" mode) but nobody has had time to implement it properly.

@msullivan
Copy link
Collaborator

Well we have done the error codes thing sort of. Closing in favor of #7599.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants
0