Vscode-ruby: couldn't find rubocop for formatting (ENOENT)

Created on 20 Jul 2018  路  8Comments  路  Source: rubyide/vscode-ruby

Your environment

  • c version: 0.18.0
  • Ruby version: 2.4.1
  • VS Code version: Version 1.25.1 (1.25.1)
  • Operating System: MacOS
  • Hardware (optional):

Make sure you have ruby, ruby-debug-ide and ruby-debug-basex19 installed before submitting your issue -- thank you !

Expected behavior

Formatting should work

Actual behavior

Shows: couldn't find rubocop for formatting (ENOENT) on window reload

Steps to reproduce the problem

  1. Install couldn't find rubocop for formatting (ENOENT)
  2. Set "ruby.format": "rubocop"
  3. Reload window

rubocop gem is installed with gem install rubocop and which rubocop shows: /Users/vedmant/.rvm/gems/ruby-2.5.1/bin/rubocop

I couldn't find a way to specify path for rubocop

Most helpful comment

can you try to add this settings to vscode , as i think this is what's used in the source code

"ruby.lint.rubocop" : { "exe" : "/Users/vedmant/.rvm/gems/ruby-2.5.1/bin/rubocop" }

All 8 comments

same here, but with rbenv instead of rvm

can you try to add this settings to vscode , as i think this is what's used in the source code

"ruby.lint.rubocop" : { "exe" : "/Users/vedmant/.rvm/gems/ruby-2.5.1/bin/rubocop" }

same error, and after I set "ruby.lint.rubocop" : { "exe" : "/Users/vedmant/.rvm/gems/ruby-2.5.1/bin/rubocop" } I got another error:
rubocop failed with code=127

I to have the same issue, but I think my situation is a bit different. I am leveraging the ruby version wrapped in ChefDK, and am getting the same error. I am running on Windows 10.

Automatic environment detection will ship for the language server in 0.22.0. See #405

I am getting a similar error in VC.
carrein@DESKTOP-MP8IGIO:~$ find . -name "rubocop" ./.rbenv/shims/rubocop ./.rbenv/versions/2.5.1/bin/rubocop ./.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rubocop-0.65.0/exe/rubocop ./.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rubocop-0.65.0/lib/rubocop

I tried all the above paths but nothing seems to work both with or without the rubocop extension from the marketplace.

Hi @Carrein

Please file a new issue around this with all the included details (such as your config and relevant output)

To make use of what @wingrunr21 mentioned, you will need to set useLanguageServer in your config to be true. I believe this comes with rubocop linting (or at least the docs suggest as much) so you should be able to disable the linting option in the ruby settings.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Snake-Sanders picture Snake-Sanders  路  4Comments

ckruse picture ckruse  路  5Comments

wingrunr21 picture wingrunr21  路  4Comments

SerkanOruc picture SerkanOruc  路  5Comments

atracy picture atracy  路  3Comments