Skip to content

autofixes for noqa-comments and rule-codes-in-suppression-comments delete the suppression comment when applied at the same time and suppression comment length from the fix would cause the import to wrap across multiple lines #27059

Description

@DetachHead

Summary

def foo():
    from aaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaa import bar  # noqa: PLC0415

    bar
# ruff.toml
target-version = "py314"
preview = true
unsafe-fixes = true

[lint]
extend-select = ["ALL"]
[lint.isort]
combine-as-imports = true

running ruff check --fix on this file causes the ignore comment to be deleted:

def foo() -> None:
    from aaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaa import (
        bar,
    )

    bar

Version

0.15.22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions