Skip to content

Rule UP032 cause autofix error #7074

Open
@qarmin

Description

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

Activity

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

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfuzzerSurfaced via fuzzing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions