Skip to content

Rule UP032 cause autofix error #7074

@qarmin

Description

@qarmin

Ruff 0.0.287 (latest changes from main branch)

ruff --fix *.py  --no-cache --select UP032

file content:

class TrainLog(object):
                    pbar += '{}={.3f} '.format(metric_name, metric[0])
                    if len(metric) == 2:
                        pbar += 'valid_{}={:.3f} '.format(metric_name,
                                                          valid_metric)

error:

error: Autofix introduced a syntax error. Reverting all changes.

This indicates a bug in `ruff`. If you could open an issue at:

    https://github.com/astral-sh/ruff/issues/new?title=%5BAutofix%20error%5D

...quoting the contents of `577788.py`, the rule codes UP032, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

577788.py:2:29: UP032 Use f-string instead of `format` call
577788.py:4:33: UP032 Use f-string instead of `format` call
Found 2 errors.

577788.py.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfuzzerSurfaced via fuzzing.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions