Skip to content

Autofix for UP032 swallows comment #6336

@WhyNotHugo

Description

@WhyNotHugo

Given this snippet:

        return "data:image/{};base64,{}".format(
            ext[1:], data.decode()  # Remove the leading dot.
        )

Ruff autofix produces this output:

        return f"data:image/{ext[1:]};base64,{data.decode()}"

Note that the autofixed code "swallows" the comment. See here for original context: WhyNotHugo/django-afip@2974184

This is reproducible with ruff 0.0.281. The relevant pyproject.toml is here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixesRelated to suggested fixes for violationsneeds-decisionAwaiting a decision from a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions