RuboCop setup and cleanup

This sets up RuboCop as part of the default `rake` task and cleans up the codebase.

Some offences (`Metrics/AbcSize`, `Metrics/ClassLength`, `Style/Documentation` and `Metrics/MethodLength`) are to be addressed in later commits, as they require non-trivial changes.

This should fix #348.