style nit. IMO this is easier to read written as:

```
if (build_attempts.unsuccessful.count - 1) < retry_count && 
    (build_instance.merge_on_success? || build_instance.project.main?)
  true
elsif elapsed_time && elapsed_time < 60 && build_attempts.unsuccessful.count < 5
  true
else
  false
end
```