SublimeLinter-Rubocop not running even when enabled and rubocop in path
Asked Answered
O

1

8

I'm trying to get Rubocop warnings to show as code marks in Sublime Text 3. I'm using SublimeLinter and the SublimeLinter-rubocop package. (The similar RuboCop package does work but doesn't seem to support code markings.)

rubocop is installed and runs from the rbenv shims folder:

$ rubocop response_test.rb
...
1 file inspected, 11 offenses detected

SublimeLinter is using the rbenv shims:

SublimeLinter: computed PATH using /bin/bash:
/Users/andrew/.rbenv/shims
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

The extension is enabled:

...
"linters": {
    "rubocop": {
        "@disable": false,
        "args": [],
        "excludes": []
    },
    ...
}
...

But the warnings don't show and the linter doesn't even appear to run:

reloading settings Packages/User/SublimeLinter.sublime-settings
SublimeLinter: ruby: response_test.rb ['/usr/bin/ruby', '-wc'] 
SublimeLinter: ruby output:
Syntax OK

Is there anything that could account for this? I'm new to Rubocop and Sublime Text so I may have missed something basic.

Overalls answered 19/1, 2017 at 23:44 Comment(0)
P
5

I just had the same problem recently, and fixed it just now. You probably have already figured it out, but here's my solution.

I believe the problem is that your sublime are searching the system original ruby's path/usr/bin/ruby'.

You have to

Firstly, specify the right path for you ruby env (rbenv in my case) in Packages/User/SublimeLinter.sublime-settings as this:

{
    ...
    "paths": {
        "linux": [],
        "osx": [
            "~/.rbenv/shims/"
        ],
        "windows": []
    },
    ...
}

After that close sublime completely and reopen it.

Hope this helps.

Plane answered 22/6, 2017 at 22:7 Comment(1)
This worked for me. But as an RVM user, my OSX path looked more like this: "/Users/ckragt/.rvm/gems/ruby-2.5.3/bin"Beckon

© 2022 - 2024 — McMap. All rights reserved.