3

I have Sublime Text 3 working with rubocop and sublimelinter. However, when I enable rubocop-rspec:

# .rubocop.yml
require: rubocop-rspec

rubocop fails on the command line in terminal unless I run it with:

bundle exec rubocop

However, I'm not able to get rubocop working nicely with rubocop-rspec in Sublime, and I see this in my Sublime console with debug enabled:

SublimeLinter: rubocop output:
/Users/sean/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- /Users/sean/Dropbox/Sean/Sites/tovgdb/rubocop-rspec (LoadError)

Is there a way to make sublimelinter put bundle exec before the rubocop command?

Sean Lerner
  • 389
  • 5
  • 9

1 Answers1

0

I found out this is a known issue with the rubocop gem: 0.38 fails to load rubocop-rspec #2937

I've temporarily commented out the code causing my issue and put back code from an earlier version of the gem:

# ~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb

# Temporary Code copied from earlier version of gem:
Array(hash.delete('require')).each { |r| require(r) }

# Code Commented Out:
# config_dir = File.dirname(path)
# Array(hash.delete('require')).each do |r|
#   require(File.join(config_dir, r))
# end
Sean Lerner
  • 389
  • 5
  • 9