Skip to content

F504: Fails to converge if unused keys are concatenated string literals #4975

@addisoncrump

Description

@addisoncrump

You can concatenate string literals like so: 'a' 'b' => 'ab'.

When F504 identifies an unused key which is defined with concatenated string literals, it fails to converge:

x = '' % {'a''b' : ''}
$ ruff concat-f504.py --no-cache --fix
debug error: Failed to converge after 100 iterations in `concat-f504.py` with rule codes F504:---
x = '' % {'a''b' : ''}

---
concat-f504.py:1:5: F504 `%`-format string has unused named argument(s): ab
Found 101 errors (100 fixed, 1 remaining).

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions