Skip to content
unurgunite edited this page Jul 11, 2026 · 4 revisions

Catalyst Rules

Static performance analysis for Crystal. 49 rules to detect allocation anti-patterns, algorithmic complexity issues, and resource leaks.

ID Rule Severity Confidence Fix
CAT-001 sort.first → min/max warning high
CAT-002 map{}.sum → sum{} warning high
CAT-003 select + reject → partition info high
CAT-004 Array#include? in loop → Set warning high
CAT-005 shift/unshift → Deque info high
CAT-006 hash.keys.each → each_key info high
CAT-007 reverse.each → reverse_each hint high
CAT-008 select.first/last → find warning high
CAT-009 group_by for counters info medium
CAT-010 String#+ in loop → String.build warning high
CAT-011 Multi-pass gsub hint medium
CAT-012 JSON.parse → Serializable info low
CAT-013 TCPSocket resource leak error high
CAT-014 File.read → streaming info high
CAT-015 Struct vs Class heuristic info medium
CAT-016 Large union types info medium
CAT-017 Time.local → Time.utc hint high
CAT-018 String#downcase == → compare hint medium
CAT-019 Regex.new in loop → constant warning high
CAT-020 IO::Memory for unread output warning high
CAT-021 values.each → each_value info high
CAT-022 shuffle.first → sample info high
CAT-023 includes? on String → char comparison info medium
CAT-024 keys/values.map → each_key/each_value info high
CAT-025 File.open resource leak error high
CAT-026 Dir.open resource leak error high
CAT-027 Tempfile resource leak error high
CAT-028 HTTP::Client resource leak error high
CAT-029 DB.open resource leak error high
CAT-030 keys.includes? → has_key? info high
CAT-031 values.includes? → has_value? info high
CAT-032 split.first → split_limit info medium
CAT-033 select.map → single-pass warning medium
CAT-034 each_with_index.map → map_with_index info high
CAT-035 split("") → each_char hint high
CAT-036 chars.each → each_char info high
CAT-037 Logging with block form info high
CAT-038 Capacity hints for large collections info medium
CAT-039 Regex.new in method → constant warning high
CAT-040 String.build for simple literals hint low
CAT-041 Parsing to constant hint low
CAT-042 sleep(0) → Fiber.yield hint high
CAT-043 Random.new reuse info medium
CAT-044 ** power → Math.pow info low
CAT-046 reverse.reverse no-op hint high
CAT-047 upcase.downcase / downcase.upcase no-op hint high
CAT-048 puts to_s redundant hint high
CAT-049 Thread.new → spawn warning high
CAT-050 Fiber.new → spawn warning high

Clone this wiki locally