SublimeLinter / SublimeLinter-rubocop

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

Executables and how we specify them #13

Closed reconbot closed 9 years ago

reconbot commented 9 years ago

I'm at the limit of my sublime linter knowledge. This will affect #9.

In ruby land we have ton of different ways to configure our setups and choose ruby versions and library paths. I'd like to support more of them.

Current Support

I've included the commands we'd need to run for the situations I know of. What's a good pattern to allow configuration of this?

groteworld commented 9 years ago

So you have a couple choices off the cuff:

  1. A setting variable that is set to some value that denotes the setup (E.x. "rbenv", "system", "rvm+bundler")
  2. Have the linter determine best one (would have to be opinionated on what's the best, and would probably want override like number 1)

Since 1, so far, seems like a common denominator it's a good idea to maybe start. Like you said, this is a combinatoric problem of the ruby eco.

jawshooah commented 9 years ago

Correct me if I'm wrong, but might not #14 help with this? Inheriting from RubyLinter should take care of hooking the linter up with rbenv or rvm (using rvm-auto-ruby).

Support for bundler should probably be added to RubyLinter in any case, since it should be common to all Ruby linters.

reconbot commented 9 years ago

It would =)

reconbot commented 9 years ago

Thanks to @jawshooah our latest version supports rvm and chruby. Bundler is next.

reconbot commented 9 years ago

I'm going to close this for now as we haven't had anyone complain about bundlr in a while.

oliviertassinari commented 7 years ago

we haven't had anyone complain about bundlr in a while.

Well, I ended-up doing the following change to get it working:

-command = ['ruby', '-S', 'rubocop', '--format', 'emacs']
+command = ['bundle', 'exec', 'ruby', '-S', 'rubocop', '--format', 'emacs']
rpbaptist commented 7 years ago

@oliviertassinari Can you let me know where I can add this?

Answering my own question: https://github.com/SublimeLinter/SublimeLinter-rubocop/blob/master/linter.py#L44

groteworld commented 7 years ago

@rpbaptist Oliver's changes were made here, though note that this is a temporary fix to the issue, and will prevent you from being able to getting automatic updates from SublimeLinter-rubocop.

felixyz commented 7 years ago

I think Bundler support or a way to easily modify the command without having to hack linter.py would be very useful. In our case, we're using CodeClimate which uses a fixed version of Rubocop, usually lagging behind the latest release. To get the same warnings locally, we have to set the same Rubocop version in our Gemfile. Of course, we could force everyone to have the correct version of Rubocop installed globally, but that's unwieldy. So consider this a +1 for sorting this out.

felixyz commented 7 years ago

Perhaps this should be handled by SublimeLinter itself, if the preferred solution is simply to let users set their own command (like Sublime RuboCop does)?