Making friends with Rubocop

By Prathamesh Sonpatki

Elevator Pitch

They don’t be friends with cops. I say make friends with good cops like Rubocop. Let’s discuss how integrating Rubocop in an existing project turns out. We will experience the pain, the sweat to overcome it and the ultimate triumph in the end. Come with me and learn how we made friends with Rubocop.

Description

Rubocop makes Ruby code better. But when you integrate it with your existing apps, it is not straightforward as just autocorrecting everything. Each decision has to be weighed in considering the state of the existing code base as well team dynamics. Mix in static nature of some of the cops which can make good suggestions but auto-correction can really mess things up. In this talk I will share how we integrated Rubocop in our Rails app and what we learned along the way. I will share what mistakes we made based on assumptions and how you can avoid them at the same time getting benefits from Rubocop.

Following points will be discussed:

  • How to go about integrating Rubocop in existing app
  • Problems faced due to static nature of some of the cops
  • Reducing the bloat of offensive code over time
  • Problems faced by relying on Rubocop in certain cases to do “right” thing
  • Finally slowly integrating Rubocop checks in workflow and project management
  • Maintaining code quality over time involving all team members

At the end we are quite happy with the friendship with all the cops and you should too!

Notes

Rubocop is one of the fantastic code quality tool. But integrating it in existing application can be huge rabbit hole. This talk will take a pragmatic approach on how to integrate it with your existing app and will share actual experiences that we have in our project. It will be helpful to maintain the code quality over time and will help teams who are looking to adopt Rubocop in their projects.

Having actually worked on different projects using and not using Rubocop and having experience of integrating Rubocop in an existing app, I feel qualified to give this talk.