You can write this as

```ruby
return host, result unless !Setting[:force_hostgroup_match_only_new] && host.present? && !host.new_record? && host.hostgroup.nil? && host.reports.empty?
```