Skip to content

CAT 007

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-007 — reverse.each → reverse_each

Severity: hintConfidence: highAuto-fix:

Tip

This rule supports auto-fix via --fix

Description

reverse.each → reverse_each — Use reverse_each instead of reverse + each to avoid allocating a reversed copy.

Bad code

ary.reverse.each { |x| ... }

Good code

ary.reverse_each { |x| ... }

Benchmark

Note

See bench results at bench/cat-007/

Clone this wiki locally