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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With