Why this matters
User input and APIs often send malformed timestamps.
Parse dates/times in begin/rescue blocks and validate expected format/timezone.
User input and APIs often send malformed timestamps.
Side-by-side examples engineers can pattern-match during review.
expires_at = Time.parse(params[:expires])expires_at = begin
Time.iso8601(params[:expires])
rescue ArgumentError
nil
endDate.parse(s)Date.iso8601(s) rescue nilFrom 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.