Please find attached pdf file for Coding Standards.

Also, refer following git repo for all Ruby idoms: https://github.com/bbatsov/ruby-style-guide

Gem you should consider for refactoring and code formatting:

  1. rubocop

  2. cane

  3. rails_best_practices

For code complexity use flog gem. Refer post [here][1] for more details.

Happy Refactoring :)
[1]: http://knowbuddy.kiprosh-app.com/kyu_entries/ruby-code-quality-metrics-and-security