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

E501 for multi-words link name #3625

Closed
FBruzzesi opened this issue Mar 20, 2023 · 2 comments · Fixed by #3663
Closed

E501 for multi-words link name #3625

FBruzzesi opened this issue Mar 20, 2023 · 2 comments · Fixed by #3663
Assignees
Labels
bug Something isn't working

Comments

@FBruzzesi
Copy link

FBruzzesi commented Mar 20, 2023

When adding links to docstring, if the link name has multiple words then E501 Line too long is raised, even if the link is in a single line. (Related to #3051)

  • Ruff version 0.0.257
  • Command ruff check <module>
  • Minimal code snippet:
    def func():
        """
        [this-is-ok](https://loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog.url.com)
        [this is not](https://loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog.url.com)
        """
        ...
@FBruzzesi FBruzzesi changed the title Multi words link name E501 for multi-words link name Mar 20, 2023
@charliermarsh
Copy link
Member

FWIW, I think the first case is unrelated to the presence of the link -- instead, it passes because there's no whitespace, so there's no way to split up the line.

We may be able to handle the second case by detecting if the last word on the line appears to be a URL, we don't do any Markdown parsing though so from the linter's perspective that line doesn't "end with" a URL.

@FBruzzesi
Copy link
Author

FBruzzesi commented Mar 20, 2023

Thank you for getting back so quickly!
Indeed such case could only happen in the docstring. However it gets caught by the parser.
A possible fix may be to check for the line to match the regex "^\[.*\]\(https?://\S+\)".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants