Why this matters
Rescuing Exception captures critical system-level errors like NoMemoryError, preventing proper application termination and potentially masking serious issues.
Exception ClassIdentify rescue Exception statements and suggest replacing them with rescue StandardError to avoid catching critical system exceptions.
Rescuing Exception captures critical system-level errors like NoMemoryError, preventing proper application termination and potentially masking serious issues.
Side-by-side examples engineers can pattern-match during review.
begin
risky_operation
rescue Exception
puts "An error occurred"
endbegin
risky_operation
rescue StandardError => error
puts "An error occurred: #{error.message}"
endFrom the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.