Setup rubocop

This setup of rubocop is very lenient to begin with. Some leniencies are
established in .rubocop.yml and other times rules are disabled
inline in the files. Over time, more rules should be enabled.

(Based on #1663).