spacemacs icon indicating copy to clipboard operation
spacemacs copied to clipboard

Rubocop not working

Open rlopzc opened this issue 6 years ago • 10 comments

Description :octocat:

Rubocop is not working. Branch: develop Ruby version: 2.5.0

Reproduction guide :beetle:

  • Start Emacs
  • Open a .rb file

Observed behaviour: :eyes: :broken_heart: A window appearns and hides, is from messages buffer:

**Messages** buffer:
Ruby: 2.5.0 Gemset: global
Suspicious state from syntax checker ruby-rubocop: Flycheck checker ruby-rubocop returned non-zero exit code 1, but its output contained no errors: /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver.rb:231:in `search_for': Unable to resolve dependency: user requested 'did_you_mean (= 1.2.0)' (Gem::UnsatisfiableDependencyError)
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver.rb:283:in `block in sort_dependencies'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver.rb:277:in `each'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver.rb:277:in `sort_by'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver.rb:277:in `with_index'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver.rb:277:in `sort_dependencies'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:52:in `block in sort_dependencies'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:69:in `with_no_such_dependency_error_handling'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:51:in `sort_dependencies'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:165:in `initial_state'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:106:in `start_resolution'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:64:in `resolve'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/resolver.rb:42:in `resolve'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/resolver.rb:188:in `resolve'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/request_set.rb:385:in `resolve'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/request_set.rb:397:in `resolve_current'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems.rb:243:in `finish_resolve'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems.rb:311:in `block in activate_bin_path'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems.rb:309:in `synchronize'
	from /Users/romario/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems.rb:309:in `activate_bin_path'
	from /Users/romario/.rvm/gems/ruby-2.5.0@global/bin/rubocop:23:in `<main>'
	from /Users/romario/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `eval'
	from /Users/romario/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `<main>'

Try installing a more recent version of ruby-rubocop, and please open a bug report if the issue persists in the latest release.  Thanks!

Expected behaviour: :heart: :smile: Rubocop linting files

System Info :computer:

  • OS: darwin
  • Emacs: 25.3.1
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 0fa3658c)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: ivy
  • Layers:
(javascript react restclient auto-completion better-defaults elixir
            (elm :variables elm-sort-imports-on-save t elm-format-on-save t)
            emacs-lisp git github html ivy markdown org osx
            (ranger :variables ranger-show-preview t)
            (ruby :variables ruby-enable-ruby-on-rails-support t ruby-enable-enh-ruby-mode t ruby-version-manager 'rvm)
            ruby-on-rails
            (shell :variables shell-default-height 30 shell-default-position 'bottom)
            spell-checking syntax-checking yaml
            (version-control :variables version-control-diff-side 'left)
            (wakatime :variables wakatime-api-key "api_key" wakatime-cli-path "/usr/local/bin/wakatime"))
  • System configuration features: NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS

Backtrace :paw_prints:

<<BACKTRACE IF RELEVANT>>

rlopzc avatar Mar 21 '18 20:03 rlopzc

I'd try gem install rubocop first and see what happens (make sure which ruby returns /Users/romario/.rvm/rubies/ruby-2.5.0/bin/ruby).

RenWenshan avatar Mar 22 '18 22:03 RenWenshan

Did that, still not working @RenWenshan , thanks

rlopzc avatar Mar 24 '18 00:03 rlopzc

@romariolopezc maybe try "M-x rvm-use" followed up with selecting 2.5.0?

RenWenshan avatar Mar 26 '18 04:03 RenWenshan

@wenshan just tried that, no success :/

On Mar 25, 2018 at 22:49, Wenshan [email protected] wrote:

@romariolopezc https://github.com/romariolopezc maybe try "M-x rvm-use" followed up with selecting 2.5.0?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/syl20bnr/spacemacs/issues/10507#issuecomment-376045309, or mute the thread https://github.com/notifications/unsubscribe-auth/AF6ZJDALV7KsNi2OyK9P3B-sKISwfeVKks5tiHM-gaJpZM4S1oOz .

rlopzc avatar Mar 26 '18 21:03 rlopzc

I experience this without the use of rvm.

arubis avatar Aug 30 '18 17:08 arubis

Me too, not using rvm, on Ruby 2.6.0:

/Users/kostask/.gem/ruby/2.6.0/gems/rubocop-0.65.0/lib/rubocop/...

vrinek avatar May 17 '19 21:05 vrinek

@romariolopezc maybe try "M-x rvm-use" followed up with selecting 2.5.5

It worked for me, installed rvm and run M-x rvm-use => fixed. My message was a little bit different

Suspicious state from syntax checker ruby-rubocop: Flycheck checker ruby-rubocop 
returned non-zero exit code 1, but its output contained no errors: 
/home/jesusbv/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:84:in `setup': undefined method `plain_specs' 
for #<Bundler::RubygemsIntegration:0x000000000286cc28> (NoMethodError)

jesusbv avatar Mar 18 '20 14:03 jesusbv

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

github-actions[bot] avatar Mar 22 '21 19:03 github-actions[bot]

Just updated to develop and ran into this issue while I was using rubocop without problem on master and from the terminal. Using rbenv, tried M-x rbenv-use 2.7.0 to no avail

Suspicious state from syntax checker ruby-rubocop: Flycheck checker ruby-rubocop returned 1, but its output contained no errors: /home/patrick/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': can't find gem rubocop (>= 0.a) with executable rubocop (Gem::GemNotFoundException)
	from /home/patrick/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
	from /home/patrick/.rbenv/versions/2.7.0/bin/rubocop:23:in `<main>'

EDIT: Figured out my issue. I migrated from rvm to rbenv a few months ago, and I thought nuking ~/.rvm would be enough to erase it. Unfortunately, my ~/.spacemacs.env was littered with rvm-related variables which really confused the ruby layer when combined with rbenv. Deleting ~/.spacemacs.env and letting Spacemacs regenerate it on next startup fixed it.

Palladinium avatar Oct 07 '21 05:10 Palladinium

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

github-actions[bot] avatar May 01 '24 16:05 github-actions[bot]