SublimeLinter / SublimeLinter-rubocop

SublimeLinter 3 plugin for Ruby, using rubocop.
MIT License
159 stars 40 forks source link

Use RubyLinter as superclass for Rubocop #16

Closed reconbot closed 9 years ago

reconbot commented 9 years ago

Builds from #14 but asks ruby to find rubocop to work with rvm with gemsets.

jawshooah commented 9 years ago

@reconbot Looks like there might be a problem with this:

SublimeLinter: rubocop version query: /Users/joshuahagins/.rvm/bin/rvm-auto-ruby --version
SublimeLinter: rubocop version: 2.2.0
SublimeLinter: rubocop: (>= 0.15.0) satisfied by 2.2.0

It's grabbing the Ruby version rather than the Rubocop version. This is because RubyLinter#lookup_executables checks the first item in cmd for the name of the gem, using the regex r'(?P<gem>.+?)@ruby'.

If there's a match, it extracts the gem name and uses util.which to find its path, and finally sets executable_path to [ruby_path, gem_path]. If there's no match, it just uses [ruby_path].

Finally, Linter#get_executable_version appends version_args to executable_path to obtain version info. In this case, the final command is rvm-auto-ruby --version, not rvm-auto-ruby -S rubocop --version.

Edit: Created a new issue for this at #17.