Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

The Journey of rubocop-daemon into RuboCop

Hayato Kawai
May 16, 2024
1.1k

The Journey of rubocop-daemon into RuboCop

I talked at RubyKaigi 2024 LT!
https://rubykaigi.org/2024/presentations/lt/

rubocop-daemon was developed independently as a personal project before being integrated into the RuboCop core as a Server Mode. In this LT, I will discuss how rubocop-daemon came into being and the process leading to its integration into the RuboCop core, sharing the lessons learned along the way. Specifically, I will focus on the challenges faced as an OSS project owner and the effective strategies for engaging with OSS projects.

Hayato Kawai

May 16, 2024
Tweet

Transcript

  1. Motivation for Creating rubocop-daemon • Running RuboCop in an editor

    is slow, typically taking about 1-2 seconds ◦ Immediate feedback during coding is essential; the code written 1 second ago is too old!
  2. Why RuboCop is Slow • Each command execution reloads RuboCop:

    $ rubocop … require 'rubocop' RuboCop::CLI.new.run Terminal RuboCop $ rubocop … require 'rubocop' RuboCop::CLI.new.run
  3. require 'rubocop' is Slow • Just require 'rubocop' takes about

    0.8 seconds without even the core 'lint' functionality $ rubocop … require 'rubocop' RuboCop::CLI.new.run Terminal RuboCop $ rubocop … require 'rubocop' RuboCop::CLI.new.run
  4. Architecture of rubocop-daemon • Save require 'rubocop' time by having

    a rubocop-daemon server preload it ◦ similar to how an HTTP server operates: rubocop-daemon (server) $ rubocop-daemon exec … Terminal $ rubocop-daemon exec …
  5. Exciting OSS Buzz • Being recognized as a third-party gem

    within the RuboCop community is rewarding • Active issues and patches are also rewarding ◦ It signs that the tool is beneficial and widely used
  6. Challenges of OSS: Increasing Support Needs • The more widely

    it is used, the more support for diverse environments is needed ◦ In rubocop-daemon, some editors/plugins require setup guides ▪ e.g. Vim, VSCode, …
  7. Challenges of OSS: Not All Patches Can be Integrated •

    Integrating a patch means taking ownership of that code ◦ taking the responsibility for future issues and reviews.
  8. Challenges of OSS: Not All Patches Can be Integrated •

    In recognition of the time spent writing the patches, I want to integrate them. ◦ It would be difficult to maintain everything
  9. Finally integrated into RuboCop core in 2022 🎉 • I'm

    happy that my feature is widely used by the RuboCop community ◦ (I'm honored to have my name credited in the RuboCop files) • Effectively handed over maintenance to RuboCop core team, who deserves trusting
  10. Conclusion: OSS is a Great Culture • OSS is a

    great culture but also brings challenges to OSS owners • Contributing upstream isn't the only option ◦ You can instead start with a third-party gem!