Skip to content

C400 unsafe fix is more unsafe than the documentation suggests #11603

Description

@simonpercivall

Ruff 0.45

The C400 unsafe fix says that that it sometimes drops comments. It may also generate broken code:

ruff check fix --unsafe-fixes --select C400

list(
    (1 for _ in range(1))
)

expected

[
    1 for _ in range(1)
]  # [1]

actual

[
    (1 for _ in range(1))
]  # [<generator object <genexpr> at ...>

Activity

  1. added
    bugAn issue describing something that isn't working, or a PR that fixes a bug
    fixesRelated to suggested fixes for violations
    on May 29, 2024
  2. charliermarsh commented on May 30, 2024

    @charliermarsh
    Member

    👍 Yeah that's a bug (rather than a question of fix safety). Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugAn issue describing something that isn't working, or a PR that fixes a bugfixesRelated 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