Setup rubocop.

Closes #702.
Interesting thanks. I found the `if` block more readable, but this changes makes sense to make the cop happy. :+1: