Skip to content

(🐞) blank-line-with-whitespace (W293) fix is highly unsafe #10038

@KotlinIsland

Description

@KotlinIsland
def test_something():
    assert foo() == """\
assert [1, 2, 3] == [1, 4, 3]
  
  At index 1 diff: 2 != 4
  Use -v to get more diff"""

Here, the white space on line 2 of the expected value is intentional, yet ruff check --fix deletes it without question.

Or is this actually a bug, and it shouldn't be applying to strings at all?

Workaround

Disable this rule and use ruff format instead, as it doesn't modify the content of strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixesRelated to suggested fixes for violations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions