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

Ignore # type: ignore and # noqa for line length #162

Closed
Dreamsorcerer opened this issue Mar 25, 2021 · 4 comments
Closed

Ignore # type: ignore and # noqa for line length #162

Dreamsorcerer opened this issue Mar 25, 2021 · 4 comments

Comments

@Dreamsorcerer
Copy link
Contributor

Dreamsorcerer commented Mar 25, 2021

When calculating the line length for B950, it would be nice to ignore trailing # type: ignore and # noqa comments.

These comments are typically not important and are just working around some issues with static checkers, so it tends to be bothersome when adding them results in more violations.

Formats that should be ignored for line length:

# type: ignore
# type: ignore[some-code]
# noqa
# noqa: B100
# type: ignore[some-code] # noqa: B100
@cooperlees
Copy link
Collaborator

cooperlees commented Mar 25, 2021

Sure, sounds good to me. We already upset PEP8 purists, so I think this is also fine. Would love another perspective tho - Maybe @ambv ?

Happy to accept a PR that adds this and shows it working with unittests! Thanks for the idea.

@dejvidq
Copy link
Contributor

dejvidq commented Feb 16, 2023

I created PR #358 with my proposed solution.

Feel free to check.

cooperlees pushed a commit that referenced this issue Mar 12, 2023
* B950: Ignores 'noqa' and 'type: ignore' comments (#162)

* Refactored removing 'noqa' and 'type: ignore' comments, added more tests

* Fixed unit tests and refactored, so the second comment replace will run only if first changed something
@FozzieHi
Copy link
Contributor

@cooperlees This can be closed now :)

@Dreamsorcerer
Copy link
Contributor Author

#358

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

4 participants