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

Support # type: ignore #188

Open
JelleZijlstra opened this issue May 14, 2021 · 9 comments
Open

Support # type: ignore #188

JelleZijlstra opened this issue May 14, 2021 · 9 comments
Labels
good first issue Good for newcomers

Comments

@JelleZijlstra
Copy link
Contributor

For compatibility, pyanalyze should support # type: ignore in addition to # static analysis: ignore. Error code-specific ignores should still work the same way. The functionality for using a custom ignore comment should not accept # type: ignore.

This can be implemented mostly in node_visitor.py.

@JelleZijlstra JelleZijlstra added the good first issue Good for newcomers label May 14, 2021
@Bhavay-2001
Copy link

Hey @JelleZijlstra, Can I work on the issue please??

@erezsh
Copy link

erezsh commented Nov 17, 2021

What is the approach here? Are you planning to attach the comments to the AST? (iirc the ast module doesn't do that on its own)

If it helps, I have some code that does exactly that, and I can clean it up and post it.

@Bhavay-2001
Copy link

Hey @erezsh, I'm new to this repo , I don't know how to work on this but surely with some guidance will be able to solve it.

@erezsh
Copy link

erezsh commented Nov 17, 2021

I'm a visitor here too. Let's see what the maintainer has to say.

@JelleZijlstra
Copy link
Contributor Author

Thanks for offering to work on this!

I think it can be implemented basically by having the current code that checks for # static analysis: ignore also check for # type: ignore. This is done simply by substring matching on the text of the program.

Edge cases to consider:

  • The error codes warning about unused ignores and ignores without a specific error code should still work.
  • The functionality for making an error accept a different error string should still work and should not accept # type: ignore.

@Bhavay-2001
Copy link

Hey @JelleZijlstra , thanks for replying. Soo as per your comment, you want us to make a program which checks for #static analysis: ignore ?? Soo basically it would be a string matching algorithm??

@JelleZijlstra
Copy link
Contributor Author

We already check for # static analysis: ignore. This issue is about adding support for # type: ignore, which would work the same way.

@Bhavay-2001
Copy link

Hey @JelleZijlstra , thanks for replying. Could you please help me on how to start or in what direction to think for the same?? Like how should I proceed on working on this issue. Thanks

@JelleZijlstra
Copy link
Contributor Author

I would clone the repo, look for the places that implement # static analysis: ignore (use grep), then extend the logic there to also cover # type: ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants