Skip to content
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

Don't fail on mypy-style '# type: ignore[code, ...]' comments #485

Closed
udim opened this issue Jan 7, 2020 · 2 comments
Closed

Don't fail on mypy-style '# type: ignore[code, ...]' comments #485

udim opened this issue Jan 7, 2020 · 2 comments

Comments

@udim
Copy link

udim commented Jan 7, 2020

Currently a comment like # type: ignore[assignment] generates the error:

Invalid type comment: ignore[assignment] [invalid-type-comment]
  Name 'ignore' is not defined
  Name 'assignment' is not defined

I would expect pytype to consider such a comment as a plain # type: ignore.

ref: https://mypy.readthedocs.io/en/latest/error_codes.html#silencing-errors-based-on-error-codes

@rchen152
Copy link
Contributor

rchen152 commented Jan 7, 2020

Hmm, I'm not sure if we'll support this mypy-specific feature, since pytype has its own way of silencing errors (https://google.github.io/pytype/user_guide.html#silencing-errors), but at a minimum we can change the # type: ignore regex to accept an error code after the ignore.

@dumblob
Copy link

dumblob commented Jan 7, 2020

I'd advocate at least for not reporting it as an error, but a warning - i.e. not hindering execution (i.e. not requiring any code changes).

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

3 participants