vscode-ruby-rubocop: Rubocop returns empty output
I’m experiencing what to me seems like a very weird issue. Whenever the extension runs, I get this message on VS Code:
command /Users/X/.rbenv/shims/rubocop returns empty output! please check configuration
The error seems clear enough but… if I run the exact same command in the command line, I get a proper output. I’ve tried making some tweaks to the configurations, namely the execution path, using bundle or not, but nothing seems to solve it. I’ve dived in the code to see where this message was being given and this supposedly only happens if the output of the command is indeed empty, so I’m not sure what’s going on. Could I do something to see exactly what command is running to try and debug it?
Anyone experienced the same?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 56
- Comments: 21
I Replace
binin the PATH withwrappersand solved the issue: vscode setting:ruby.rubocop.executePath": "/Users/USER_NAME/.rvm/gems/ruby-2.6.5/wrappers/Just in case this helps anyone, I had a bad
.rubocop.ymlfile in my home folder (/Users/myusername/.rubocop.yml) that was being loaded as part of the stack. Deleting it, so rubocop only used the project’s own config, fixed it for me. Such a dumb fucking issue I’ve had for years, now finally dealt with. I am in ecstasyThanks for this. I am running rbenv and for me in
.vscode/settings.jsonI needed to add:"ruby.rubocop.executePath": "/Users/<username>/.rbenv/shims/"and reload window and then it workedoh my god, whole day setting up rvm in this mac, and finally just got done with rubocop. Thank you
My case is that I have a
.rubocop.ymlfile in the project root, but the config content has dependencies not installed. Afterbundle install, Rubocop works well.@loteresa2 I believe that in my case what was happening was that I was using a rubocop file that had some cops that were invalid (for the rubocop version I was using), and that was resulting in an empty output.
I remember downgrading to a version where the cop file was valid and went from there.
Sorry if this isn’t too specific but let me know if if helps. If I remember something else, I’ll be sure to let you know.
Encountered this error with asdf.
which rubocopto get the path. Should return asdf with shims e.g./Users/_username_/.asdf/shims/rubocopreplaced rubocop with'bundle exec 'with trailing whitespace as below.I solved this by making sure I could open vscode from the terminal. From Visual Studio Code, press Cmd+Shift + P and write “Shell command: Install ‘code’ command in PATH”. Hit enter:
When activated, go to your project in the terminal and execute “code .”
I should then work as VSCode will pick up the environment you’re using.
In my case, I’ve configured on settings.json
"ruby.rubocop.executePath": "/home/username/folder/ror-project/.rubocop.yml"(I’ve the idea to change it when I’ll work on other project), but I’ve the next warning on vscodecommand /home/username/folder/ror-project/.rubocop.ymlrubocop returns empty output! please check configuration.. It looks like an additional rubocop word at the end.@quaos Have you resolved this issue? I got the same issue again.
I’ve been having this issue on and off and different things solve it. This time around,
gem uninstall rubocopthenbundle installfixed itUpdate: I also needed to install from root. Since my gemfile was specific to the project and i didn’t want the latest rubocop, i just ran
gem install rubocop -v 0.73.0@ReneMoraales it was the lack of a
.rubocop.ymlin the actual project that did it for me here. As soon as I added one it, it was resolved in VS Code.@misogi if I understand this correctly, the
rubocopcommand did not return anything in stdout because the command failed, right? Would it possible to show the result in stderr instead in the error notification?I use rbenv, and the issue was caused by me upgrading Rubocop from 0.68 to 1.17 - so a big jump.
Many of my cops in my
.rubocop.ymlwere deprecated or obsolete, so once I updated these cops it worked again in VSCode. I think the issue (in my case) was caused by this extension not being able to handle the output from Rubocop and so it threw a generic and confusing error.