Open inoa-jboliveira opened 3 months ago
Giving a quick look at the implementation, all this sounds like it is by design. There is nothing in the docs that says it, but I see a test file that have several formatting lines are being ignored.
It does sound that these options are being accepted only because there is no automated fix instead of because they are fine. There is zero reason for someone to write this in 2024 (or even 10 years ago), as the test file suggests:
"%(1)s" % {"1": "bar"}
All the old style string formatting options, except for bytestrings, should be deemed errors under UP031. Having a fix available for those cases or not is what should be considered instead.
Ruff version 0.5.4
The following conversion codes are currently being ignored by UP031 instead of showing as errors:
E.g.:
The presence of any of these items such as
%d
in a string will make it ignored by UP031 even if it has another supported one, such as%s
:Please support all of the valid conversion codes from this table: https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting
Also, if an invalid code is present (either by you not supporting or being invalid), still it should show the error for valid ones. The only difference is that you don't want to supply a fix in this case