Skip to content

CAT 026

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-026 — Dir.open resource leak

Severity: errorConfidence: highAuto-fix:

Warning

This rule flags real bugs, not just performance issues.

Description

Dir.open resource leak — Dir.open without a block leaks directory handles. Use the block form for automatic closing.

Bad code

d = Dir.open("/path")
files = d.entries

Performance Impact

Tip

This rule can significantly improve performance in hot code paths.

Benchmark

Note

See bench results at bench/cat-026/

Clone this wiki locally