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

Rescue Squad: Rails Edition - Rails Israel 2014

Ben Lovell
November 04, 2014

Rescue Squad: Rails Edition - Rails Israel 2014

Ben Lovell

November 04, 2014
Tweet

More Decks by Ben Lovell

Other Decks in Programming

Transcript

  1. ! "

  2. ME!

  3. !!!

  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. $ rake stats +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines | LOC

    | Classes | Methods | M/C | LOC/M | +----------------------+-------+-------+---------+---------+-----+-------+ | Controllers | 1995 | 1613 | 34 | 179 | 5 | 7 | | Helpers | 485 | 401 | 0 | 67 | 0 | 3 | | Models | 2793 | 2196 | 45 | 352 | 7 | 4 | | Mailers | 37 | 31 | 1 | 5 | 5 | 4 | | Javascripts | 31894 | 17140 | 0 | 1553 | 0 | 9 | | Libraries | 2455 | 1878 | 85 | 233 | 2 | 6 | | Controller specs | 3468 | 2801 | 0 | 16 | 0 | 173 | | Helper specs | 264 | 213 | 1 | 3 | 3 | 69 | | Lib specs | 247 | 195 | 0 | 0 | 0 | 0 | | Model specs | 3970 | 3241 | 1 | 21 | 21 | 152 | | Routing specs | 109 | 89 | 0 | 0 | 0 | 0 | | Service specs | 125 | 103 | 0 | 0 | 0 | 0 | | Uploader specs | 9 | 8 | 0 | 0 | 0 | 0 | | View specs | 975 | 788 | 0 | 20 | 0 | 37 | +----------------------+-------+-------+---------+---------+-----+-------+ | Total | 48826 | 30697 | 167 | 2449 | 14 | 10 | +----------------------+-------+-------+---------+---------+-----+-------+ Code LOC: 23259 Test LOC: 7438 Code to Test Ratio: 1:0.3
  11. All the metrics! $ gem install metric_fu cane, churn, flog,

    flay, reek roodi, saikuro, code statistics rails best practices
  12. % 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