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

Document how to silence flake8 etc. using # noqa #4305

Closed
JukkaL opened this issue Dec 1, 2017 · 3 comments
Closed

Document how to silence flake8 etc. using # noqa #4305

JukkaL opened this issue Dec 1, 2017 · 3 comments

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Dec 1, 2017

This is a common issue for people using type comments:

from typing import List  # Linter complains about unused import
a = []  # type: List[int]

# noqa helps with flake8 (and maybe other linters):

from typing import List  # noqa
a = []  # type: List[int]

Document this is common issues.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Dec 1, 2017

This came up in #4302 most recently but has been a common issue at Dropbox as well. At Dropbox we have custom lint hacks to make linters not complain about imports only used within type comments, but they aren't publicly available, as far as I know.

@tjerkw
Copy link

tjerkw commented Oct 24, 2018

@JukkaL how did you fix it at dropbox? Is there something out there we can use? I dislike the #noqa comments in the code.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Oct 24, 2018

@tjerkw I didn't work on that fix, but I have a vague recollection about adding a linter pass that looks for type comments and adds dummy references to every name used in a type comment to the end of the source file before actual linting. @gvanrossum may know more.

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

2 participants