Refactor code and remove rubocop exclusions
Related to gitlab-org/gitlab#329694 (closed)
This MR removes rubocop exclusions and refactors code to support that. Improvements were also made to .rubocop.yml
file to make sure rubocop is running on our target Ruby version.