“A Ruby static code analyzer, based on the community Ruby style guide.” – Rubocop Github page
Rubocop is a code analyzer that enforces the rules presented in the ruby style guide through static analysis. It helps you write code that adheres to the best practices in the Ruby community. You can install Rubocop by simply running
$ gem install rubocop. In order for rubocop to be executed by sublime and act as a linter, you will need to install the package “SublimeLinter-rubocop.” To install the package do the following:
1 2 3 4
If there are rules that you want to override then it’s as simple as adding a .rubocop.yml file to the root of your project. In that file you can specify which default rubocop rules you would like to override. Here is an example of a rule that I’m overriding to prevent rubocop from linting lines with more than 80 characters:
1 2 3 4
All of thsese packages can be installed by following the steps listed above for Rubocop.
DashDoc (OS X users only)
DashDoc adds Dash integration in to Sublime. For example if you want to look up the documentation for the
before_action method then you just highlight it and press
ctrl + h. Doing this will open Dash and the ruby documentation for this method will be displayed.
All Autocomplete expands the autocompletion feature in sublime to search all the files that are open in the editor rather than just the file that you are working on.
GitGutter shows an icon in the gutter for any line that you have added, deleted, or modified.
Sublime makes it easy to customize all aspects of the editor by specifying custom settings.
Here is a list of settings that I am using (see below). I would suggest using this as a starting point to tweek things to what works best for you:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Sublime Text 3 Only:
This setting ensures that all files in your project are indexed. This means that you can use the Goto Definition and Goto Symbol features to go directly to the spot where something is defined. This is a huge time saver.