linter-rubocop icon indicating copy to clipboard operation
linter-rubocop copied to clipboard

Autodetect different rubocop binary for different projects

Open phlegx opened this issue 6 years ago • 5 comments

I'm using RVM (Ruby version manager) to manage my ruby installations and and to manage the bundler gem sets. It would be handy that linter-rubcop could detect the proper Rubocop binary depending on the project I have opened in Atom. Is there a way that linter-rubocop package can handle that?

phlegx avatar Oct 19 '18 11:10 phlegx

yeah this has become a big issue for using atom rubocop as I have a bunch of different projects that are all on different ruby versions. So when I have open two at once there is a high likelyhood that one is showing rubocop errors.

danmayer avatar May 21 '19 03:05 danmayer

It is a good proposal, that involves

  • the execution of rvm-exec current to know which is the current gemset (ex: 2.3.1, needs .rvmrc)
  • the execution of Rubocop in the current gemset with rvm 2.3.1 do rubocop

does anyone know another or better approach?

vzamanillo avatar May 30 '19 20:05 vzamanillo

I was actually able to get this to work by just changing Atom's config for linter-rubocop. This works for RVM, not sure if other ruby version managers have an equivalent

"*":
  "linter-rubocop":
    command: "rvm in . do rubocop"

The key point here is that linter-rubocop executes with the right working directory, but that doesn't have the same effect as cding there in a shell.

blowfishpro avatar Apr 05 '20 04:04 blowfishpro

@blowfishpro, Thank you for your suggestion, Joseph!! very useful.

vzamanillo avatar Apr 21 '20 17:04 vzamanillo

I was actually able to get this to work by just changing Atom's config for linter-rubocop. This works for RVM, not sure if other ruby version managers have an equivalent

"*":
  "linter-rubocop":
    command: "rvm in . do rubocop"

The key point here is that linter-rubocop executes with the right working directory, but that doesn't have the same effect as cding there in a shell.

This should be in the documentation.

73 avatar Jun 04 '21 09:06 73