The automatic fix for RUF052 introduces inconsistent parameter renaming in overload definitions. Specifically, if a parameter name is prefixed with an underscore (e.g., _param), the fixer renames it inconsistently across overloads and the main function. This leads to invalid overload definitions, as parameter names must match exactly between overloads and the implementation.
@overload
def func(
tp: str, value: object, /, *, strict: bool = True, eval: bool = True, _param: str = "func"
) -> bool: ...
@overload
def func(
tp: type[_T], value: object, /, *, strict: bool = True, eval: bool = True, _param: str = "func"
) -> _T | None: ...
def func(
tp: str | type[_T] | object, value: object, /, *, strict: bool = True, eval: bool = True, param: str = "func"
) -> _T | object | None: ...
I am not fully up to date on the process or discussions around RUF052, but given the potential for these changes to render code invalid, I wonder why wasn’t this fix categorized as an unsafe fix requiring explicit user consent in the first place?
The automatic fix for RUF052 introduces inconsistent parameter renaming in overload definitions. Specifically, if a parameter name is prefixed with an underscore (e.g., _param), the fixer renames it inconsistently across overloads and the main function. This leads to invalid overload definitions, as parameter names must match exactly between overloads and the implementation.
I am not fully up to date on the process or discussions around RUF052, but given the potential for these changes to render code invalid, I wonder why wasn’t this fix categorized as an unsafe fix requiring explicit user consent in the first place?