Skip to content

Instantly share code, notes, and snippets.

@sourabh-upadhyay
Created February 24, 2017 05:28
Show Gist options
  • Save sourabh-upadhyay/d33125aca1554ed088792a637086a3e4 to your computer and use it in GitHub Desktop.
Save sourabh-upadhyay/d33125aca1554ed088792a637086a3e4 to your computer and use it in GitHub Desktop.
Install linter with Rubocop in Sublime

In order to enable rubocop for your sublime package 3 you first need to make sure the control package of sublime is installed on your sublime package. To check for the control package Way 1: Step 1 -> open sublime package 3 and press ctrl + shift + p wait for some time (hardly 5 seconds) it will open a text field in the sublime package. Step 2 -> Type install if you see Package Control : Install package then the control package is install. If you donot have sublime package then install it first. Way 2: Step 1 -> Go to /home/username/.config/sublime-text-3/Installed Packages username will be user of your system. eg amit, rohit This path is according to the ubuntu system. You basically need to go to installed package directory of sublime Step 2 -> look for the Package Control.sublime-package If this exist then the control package is already installed.

In order to install sublime package control Step 1 : open sublime Step 2 : Press ctrl + ` to open console of sublime Step 3 : Click on the last input field Step 4 : copy the below code and past it in that import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by) Step 5 : Hit enter. Step 6 : After some time restart sublime. Now again check for the control package.

Install SublimeLinter-rubocop using package control Step 1 : Open sublime Step 2 : Press ctrl + shift + p Step 3 : Type install in it Step 4 : Click on package control : install package Step 5 : Type SublimeLinter-rubocop Step 6 : Click on the first suggestion of SublimeLinter-rubocop Step 7 : It will get install within some time (hardly 5 to 10 seconds) Step 8 : Again restart sublime. Install sublimelint using package control Step 1 : Open sublime Step 2 : Press ctrl + shift + p Step 3 : Type install in it Step 4 : Click on package control : install package Step 5 : Type sublimelint Step 6 : Click on the first suggestion of sublimelint Step 7 : It will get install within some time (hardly 5 to 10 seconds) Step 8 : Again restart sublime.

Now for getting rubocop offence Install rubocop gem in the global gemset of default ruby version.

Again restart sublime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment