$ cat ruf052.py
def f(_x):
return _x
print(f(_x=1))
$ python ruf052.py
1
$ ruff check --isolated --preview --select RUF052 ruf052.py --fix
Found 1 error (1 fixed, 0 remaining).
$ cat ruf052.py
def f(x):
return x
print(f(_x=1))
$ python ruf052.py
Traceback (most recent call last):
File "ruf052.py", line 3, in <module>
print(f(_x=1))
^^^^^^^
TypeError: f() got an unexpected keyword argument '_x'
The fix for
used-dummy-variable(RUF052) in Ruff 0.8.2 can introduce errors when renaming a function parameter. It should be marked unsafe in that context unless the parameter is positional-only.