Skip to main content

How to install Rubocop for Sublime Text with rbenv

1 min read

Rubocop is a static code analyzer and formatter for Ruby. Long story short : it helps you to write better code.

Installing it pretty straight-forward :

gem install rubocop

Within Sublime Text Control Panel (CTRL+Shift+P) :

  1. Find Package Control: Install Package
  2. Then Rubocop (currently v2018.
  3. Hit enter

By default, the ST plugin will look for rvm, not rbenv. We have to force the settings Preferences > Package Settings > Rubocop > Settings - Users, and paste this :

Now we can have a list of the available options by typing rubocop withing the Control Panel (CTRL+Shift+P).