Skip to content

static-join

Pythonstyleno fixdefault: offpython/ruff

Reports "sep".join([a, b]) where the list or tuple is written out in the call.

The items are known where they are written, so the result is a fixed text with the items inserted, which an f-string says directly without building a list.

To fix, write an f-string: f"{a}, {b}".

Reported
...
a = b = "x"
x = ", ".join([a, b])
...
...
python:
lint:
rules:
static-join: warn # off (default), warn, error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line static-join in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ruff FLY002 full