Will It Vibe logoWill It Vibe?
PY-021Low severity-4 points

String concatenation with += inside a loop

Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 4 points from that category, once per scan, no matter how many places it turns up.

What it detects

Strings are immutable, so name += chunk inside a loop rebuilds the whole string every iteration instead of appending in place, making the loop quadratic. Heuristic: cannot fully confirm the accumulator is a string rather than a number or list.

Why it matters

Strings in Python are immutable, so name += chunk inside a loop does not append in place: it builds a brand new string of the combined length on every single iteration and copies all the previous content into it. Over many iterations this becomes quadratic work for what should be linear-time string building, and on large inputs, a big CSV export, a large log aggregation, it can turn a fast operation into a visibly slow one. This check is a heuristic: it cannot fully confirm the accumulator is a string rather than a number or list, so treat a flagged case as worth a quick look rather than a guaranteed bug.

How to fix it

Accumulate the pieces in a list and join them once at the end: parts = []; for row in rows: parts.append(...); return "".join(parts). This does one allocation for the final string instead of one per iteration.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Code Quality & Syntax checks