Skip to content

CAT 030

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-030 — keys.includes? → has_key?

Severity: infoConfidence: highAuto-fix:

Description

keys.includes? → has_key? — Use has_key? instead of .keys.includes? to check key existence without allocating an array.

Bad code

hash.keys.includes?(:foo)

Benchmark

Note

See bench results at bench/cat-030/

Clone this wiki locally