Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RESCUE SQUAD: Rails Edition - Ancient City Ruby...

RESCUE SQUAD: Rails Edition - Ancient City Ruby 2015

Ben Lovell

March 28, 2015
Tweet

More Decks by Ben Lovell

Other Decks in Programming

Transcript

  1. ! "

  2. !!!

  3. DHH

  4. CI

  5. !

  6. $ gem install rubocop ~/code/frontend % rubocop Inspecting 313 files

    .....................................................C ...................................................... ...................................................... ...................................................... ...................................................... ........................................... Offenses: app/helpers/profile_helper.rb:2:1: C: Extra empty line detected at body beginning. 313 files inspected, 1 offense detected
  7. ~/code/frontend % rubocop -a Inspecting 313 files .....................................................C Offenses: app/helpers/profile_helper.rb:2:1:

    C: [Corrected] Extra empty line detected at body beginning. 313 files inspected, 1 offense detected, 1 offense corrected
  8. $ gem install flay ~/code/frontend % flay app/**/*.rb -f Total

    score (lower is better) = 256 1) Similar code found in :call (mass = 148) app/controllers/styleguide_controller.rb:63 app/controllers/styleguide_controller.rb:221 2) Similar code found in :defn (mass = 108) app/helpers/application_helper.rb:2 app/helpers/application_helper.rb:9 app/helpers/application_helper.rb:16 app/helpers/application_helper.rb:23 app/helpers/application_helper.rb:30 app/helpers/application_helper.rb:37
  9. $ gem install churn ~/code/blog % churn Files +----------------------------------------------------------+---------------+ |

    file_path | times_changed | +----------------------------------------------------------+---------------+ | Gemfile | 20 | | app/helpers/application_helper.rb | 14 | | app/models/article.rb | 11 | | spec/models/text_filter_spec.rb | 11 | | spec/controllers/articles_controller_spec.rb | 11 | | spec/controllers/setup_controller_spec.rb | 11 | | spec/rails_helper.rb | 10 | | app/models/blog.rb | 10 | | spec/models/article_spec.rb | 10 | | spec/controllers/admin/content_controller_spec.rb | 10 | | spec/helpers/application_helper_spec.rb | 10 | +----------------------------------------------------------+---------------+
  10. All the metrics! $ gem install metric_fu cane, churn, flog,

    flay, reek roodi, saikuro, code statistics rails best practices
  11. % tree spec/models spec/models ├── authentication_token_spec.rb ├── challenge_spec.rb ├── entry_spec.rb

    ├── facebook_token_spec.rb ├── follow_spec.rb ├── followed_list_spec.rb ├── item_spec.rb ├── list_fulfilment_criterion_spec.rb ├── list_spec.rb ├── prize_spec.rb ├── rating_spec.rb └── user_spec.rb 0 directories, 12 files