Skip to content

Formatter conflict with E501 and comments #7471

@shughes-uk

Description

@shughes-uk

Ruff version 0.0.289

Before

if (
    "aaaaaaaaaaaaaaaaaaaa"
    and "sdasdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"  # type: ignore
):
    pass

After ruff format

if (
    "aaaaaaaaaaaaaaaaaaaa" and "sdasdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"  # type: ignore
):
    pass

There's now an E501 violation, due to the length of the comment. I'm guessing this is a disparity between the formatter ignoring comments for line length calculations and E501 not.

I understand there's some disparity between the way black handles line length and ruff, but i'd expect the ruff formatter to be consistent with ruff's line length rules, which is not the case here.

Metadata

Metadata

Assignees

Labels

acceptedReady for implementationformatterRelated to the formatter

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions