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

'Line too long' error for py2 style type annotations #4591

Closed
hardikkat24 opened this issue Jun 17, 2021 · 3 comments
Closed

'Line too long' error for py2 style type annotations #4591

hardikkat24 opened this issue Jun 17, 2021 · 3 comments
Labels

Comments

@hardikkat24
Copy link

Question

I am adding # type: ignore[error-code] pragmas to my codebase where I need to suppress MyPy type annotation errors.
For example:

constants.LONG_VARIABLE_NAME # type: ignore[attr-defined]

Here the linter throws errors like this:
C:691, 0: Line too long (112/80)
I don't want these errors for type annotations. How to solve this?

@Pierre-Sassoulas
Copy link
Member

For pylint there is a proposition to implement #1682, maybe there is a similar ticket for mypy type ignore ? If we start ignoring some constructs because there "justified" to go above the limit this is a slippery slope, so we're not going to do it. The line is really too long. You can make the limit higher or disable the check for the whole project, for the file, the function or... the line 😄.

# pylint: disable=line-too-long
constants.LONG_VARIABLE_NAME  # type: ignore[attr-defined]
# pylint: enable=line-too-long

@hardikkat24
Copy link
Author

@Pierre-Sassoulas Thanks a lot! Is there any way I can ignore the comments starting with 'type:'? Or something other than this?

@Pierre-Sassoulas
Copy link
Member

I don't think there is another way than disabling the warning or changing the limit to a higher number.

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

No branches or pull requests

2 participants