Skip to content

B950: Propose exemption for long URLs #176

@vastbluesky

Description

@vastbluesky

I like the idea of using B950 over E501, but I do not want to be warned anytime I include a long URL in a comment. Breaking URLs over multiple lines is not acceptable as I want them to be clickable.

pycodestyle addresses this by making an exemption to the line length error for comments that contain no whitespace. See line 304 (currently) of pycodestyle.py:

# Special case for long URLs in multi-line docstrings or
# comments, but still report the error when the 72 first chars
# are whitespaces.
chunks = line.split()
if ((len(chunks) == 1 and multiline) or
    (len(chunks) == 2 and chunks[0] == '#')) and \
        len(line) - len(chunks[-1]) < max_line_length - 7:
    return

I propose adding a similar exemption to flake8-bugbear. Of course, I could add a # noqa comment after every URL comment, but I much prefer pycodestyle's solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions