Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubocop not working #10507

Open
rlopzc opened this issue Mar 21, 2018 · 9 comments
Open

Rubocop not working #10507

rlopzc opened this issue Mar 21, 2018 · 9 comments
Labels

Comments

@rlopzc
Copy link

rlopzc commented Mar 21, 2018

Description :octocat:

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

Reproduction guide 🪲

  • Start Emacs
  • Open a .rb file

Observed behaviour: 👀 💔
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: ❤️ 😄
Rubocop linting files

System Info 💻

  • OS: darwin
  • Emacs: 25.3.1
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 0fa3658)
  • 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 🐾

<<BACKTRACE IF RELEVANT>>
@RenWenshan
Copy link

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).

@rlopzc
Copy link
Author

rlopzc commented Mar 24, 2018

Did that, still not working @RenWenshan , thanks

@RenWenshan
Copy link

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

@rlopzc
Copy link
Author

rlopzc commented Mar 26, 2018 via email

@arubis
Copy link

arubis commented Aug 30, 2018

I experience this without the use of rvm.

@vrinek
Copy link

vrinek commented May 17, 2019

Me too, not using rvm, on Ruby 2.6.0:

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

@jesusbv
Copy link

jesusbv commented Mar 18, 2020

@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)

@duianto duianto added the Ruby label Mar 22, 2020
@github-actions
Copy link

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 github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Mar 22, 2021
@Palladinium
Copy link

Palladinium commented Oct 7, 2021

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.

@github-actions github-actions bot removed the stale marked as a stale issue/pr (usually by a bot) label Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants