Fix most of rubocop warnings

Prefer `detect` over `find`.