Introduce RuboCop and fix offenses

* Add RuboCop configuration
* Fix offenses

This does not fix all offenses. These can be fixed as and when the
relevant code is touched. The following offenses are left:

- Metrics/ClassLength
- Metrics/LineLength
- Metrics/MethodLength
- Metrics/ParameterLists
- Style/Documentation
Merge pull request #297 from troessner/issue-add-rubocop-config

Start using RuboCop