Sublime Linter Rubocop Reboot

Published Saturday, April 18, 2015

This week’s Ruby Weekly had a nice post from Matt Brictson on “Setting up Sublime Text 3 for Rails Development”. It reminded me to finally install the SublimeLinter-rubocop package. This package syncs your linter up with rubocop, highlighting “bad code” as you type (according to the community Ruby Style Guide). Great addition, right?

Well, word to the wise: don’t install a new linter package a couple hours before a technical interview. I didn’t have a chance to tweak the default settings, which as you’ll see below, are a bit…aggressive.

Mark Style Outline

I knew I’d be pair-programming with my interviewer, and no way was I gonna subject her to literally ugly code. I had to scramble to find a fix, and after jumping through a couple different sections in the SublimeLinter documentation, I found the solution. Here’s the lowdown.

Turns out you have 5 different linter mark styles to choose from. The package defaults to "mark_style": "outline". That style’s a little visually overwhelming with my current color scheme, so I decided to switch to the "mark_style": "none", so marks appear in the gutter only.

The easiest way to do this is through the Command Palette:

  1. Press command(⌘)-shift-p to pull up the Command Palette
  2. Type mark and select SublimeLinter: Choose Mark Style
  3. Type or click to select the mark style you want to use
    • fill
    • outline
    • solid underline
    • squiggly underline
    • stippled underline
    • none

There’s also a few other ways to do this:

Menu > Tools
Go to the Sublime Text menu bar and select Tools > SublimeLinter > Mark Style.

Context Menu
Right click within the file view to pull up the context menu, then select SublimeLinter > Mark Style

SublimeLinter.sublime-settings
Open up the SublimeLinter.sublime-settings file and edit "mark_style":

{
    "user": {
        "debug": false,
        "error_color": "D02000",
        "lint_mode": "background",
        "linters": {
            "rubocop": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
        },
        "mark_style": "none",
        "no_column_highlights_line": true,
        "passive_warnings": false,
    }
}

Now you’ve got total control over the aggressiveness of your linter highlighting. Thanks Rubocop!

Rubocop puppies