Summary
logging-eager-conversion (RUF065) emits a false positive when the argument with the putatively unnecessary conversion follows an unpacked argument. The rule assumes the unpacked argument corresponds to exactly one format specifier, but it might not. The suggested fix can change the program’s behavior. Example:
$ cat >ruf065.py <<'# EOF'
import logging
logging.warning("%s%s%s%s %r", *"1234", str(5))
# EOF
$ python ruf065.py
WARNING:root:1234 '5'
$ ruff --isolated check --preview --select RUF065 ruf065.py
logging-eager-conversion: Unnecessary `str()` conversion when formatting with `%s`
--> ruf065.py:2:41
|
1 | import logging
2 | logging.warning("%s%s%s%s %r", *"1234", str(5))
| ^^^^^^
|
Found 1 error.
$ sed -i.bak 's/str//' ruf065.py # This is implied to be the fix
$ python ruf065.py
WARNING:root:1234 5
Version
ruff 0.15.22 (0177a7e 2026-07-16)
Summary
logging-eager-conversion(RUF065) emits a false positive when the argument with the putatively unnecessary conversion follows an unpacked argument. The rule assumes the unpacked argument corresponds to exactly one format specifier, but it might not. The suggested fix can change the program’s behavior. Example:Version
ruff 0.15.22 (0177a7e 2026-07-16)