mrcljx / rubocop-for-rubymine

DEPRECATED: RubyMine supports RuboCop now
https://blog.jetbrains.com/ruby/2017/01/rubymine-2017-1-eap-2-creating-gemsets-rubocop-support/
MIT License
131 stars 29 forks source link

Support user-installed gems #24

Closed lowjoel closed 8 years ago

lowjoel commented 8 years ago

Currently Rubocop for Rubymine will use bundle exec to run Rubocop the moment it sees a Gemfile. I'd imagine that it would make sense if Rubocop were installed globally or as a user-based install (gem --user-install).

In that case, Rubocop won't be in the SDK directory.

I imagine there should be some list of paths to check and those paths be checked, and the correct one being given to Ruby to run.

mrcljx commented 8 years ago

I would accept a PR which adds this feature by properly talking to IDEA to find the binary - or even better: leaving the invoking of Rubocop to IDEA in General. But I didn't find an easy way yet. I think this is also related to #11.

But I must admit that having a project which should be linted and not having gem 'rubocop' in the group :development in the Gemfile seems wrong to me.

Also from my experience with Rubocop a year back, rubocop.yml is often bound to a certain Rubocop version. At one point they changed the whole format and added namespacing. But in other cases they just might add new features / rename linters. Because of that I would highly recommend adding Rubocop to the Gemfile so that it works with the .rubocop.yml in that project.

lowjoel commented 8 years ago

It gets even more fun when we use a service like Hound :) locking the Gemfile to a version isn't necessarily effective.

I hope to eventually be able to deal with this, but I'm short of time.

mrcljx commented 8 years ago

Hi @lowjoel, I just pushed 3.1.0 to JetBrains plugin registry which delegates everything to RubyMine's internal handling of Gems/Bundler/RVM/rbenv (found some new APIs in RubyMine 8 which weren't there before) which should find/include system gems correctly. Please re-open the issue if the problem persists.

lowjoel commented 8 years ago

Cool! let me have a shot.

lowjoel commented 8 years ago

@sirlantis I don't get any messages saying that Rubocop's missing, but I don't see any annotations when running a manual code inspection either... Any way to get some diagnostics?

mrcljx commented 8 years ago

If no annotations are shown ruby mine couldn't find rubocop anywhere. So if you go to preferences > Sdk and there is no rubocop in the right column, that is the expected behavior.

lowjoel commented 8 years ago

capture

It is in there, I think it's something else. I didn't manually add that, it was detected automatically.

lowjoel commented 8 years ago

@sirlantis With that configuration, is Rubocop for Rubymine expected to work?