Skip to content

RUF057 has false positives with starred arguments #21209

@dscorbett

Description

@dscorbett

Summary

unnecessary-round (RUF057) has false positives with starred arguments. Example:

$ cat >ruf057.py <<'# EOF'
print(round(125, **{"ndigits": -2}))
print(round(125, *[-2]))
# EOF

$ python ruf057.py
100
100

$ ruff --isolated check ruf057.py --select RUF057 --fix
Found 2 errors (2 fixed, 0 remaining).

$ cat ruf057.py
print((125))
print((125))

$ python ruf057.py
125
125

Version

ruff 0.14.3 (8737a2d 2025-10-30)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions