Skip to content

CAT 011

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-011 — Multi-pass gsub

Severity: hintConfidence: mediumAuto-fix:

Description

Multi-pass gsub — Multiple gsub calls on the same string create intermediate strings. Consider a single pass or using a regex alternation.

Bad code

str.gsub(/foo/, "bar").gsub(/baz/, "qux")

Benchmark

Note

See bench results at bench/cat-011/

Clone this wiki locally