Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Gitpod: Can't find rubocop command #761

Open
shafy opened this issue Aug 16, 2021 · 4 comments
Open

Gitpod: Can't find rubocop command #761

shafy opened this issue Aug 16, 2021 · 4 comments
Labels
bug Bug reports

Comments

@shafy
Copy link

shafy commented Aug 16, 2021

Your environment

  • vscode-ruby version: 0.27.0
  • Ruby version: 3.0.0
  • Ruby version manager (if any): RVM
  • VS Code version: 1.58.2
  • Operating System: Gitpod (I think Linux)
  • Using language server? (eg useLanguageServer is true in your configuration?) Yes

Expected behavior

I expect VS Code to find rubocop as it is installed as a gem and is accessible from the terminal.

Actual behavior

This issue is probably specific to Gitpod and I have found a solution that feels hacky. So I would like to discuss it here and see if I'm missing something. When I install Ruby with the following Dockerfile, rubocop is accessible from the terminal but VS Code can't find the command:

FROM gitpod/workspace-postgres
USER gitpod

# Install the Ruby version specified in '.ruby-version'
COPY --chown=gitpod:gitpod .ruby-version /tmp
RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc
RUN bash -lc "rvm reinstall ruby-$(cat /tmp/.ruby-version) && rvm use ruby-$(cat /tmp/.ruby-version) --default && gem install rails"
RUN echo "rvm_gems_path=/workspace/.rvm" > ~/.rvmrc

I get the following error in the Language Server Output:

Lint: executing rubocop -s '/workspace/fugu/app/controllers/projects_controller.rb' -f json -R -l...

Lint: unable to execute rubocop -s '/workspace/fugu/app/controllers/projects_controller.rb' -f json -R -l as the command could not be found

SIGPIPE received

which ruby returns this:

/home/gitpod/.rvm/rubies/ruby-3.0.0/bin/ruby

which rubocop returns this:

/workspace/.rvm/ruby-3.0.0/bin/rubocop

Both paths are in my $PATH variable.

If I install the rubocop gems like this in the Dockerfile, it works:

FROM gitpod/workspace-postgres
USER gitpod

# Install the Ruby version specified in '.ruby-version'
COPY --chown=gitpod:gitpod .ruby-version /tmp
RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc
RUN bash -lc "rvm reinstall ruby-$(cat /tmp/.ruby-version) && rvm use ruby-$(cat /tmp/.ruby-version) --default && gem install rails rubocop rubocop-performance rubocop-rails rubocop-rspec"
RUN echo "rvm_gems_path=/workspace/.rvm" > ~/.rvmrc

You can find my repo here run it directly in Gitpod here (you need a free Gitpod account).

Is this expected behavior or some bug?

@github-actions
Copy link

This issue has not had activity for 30 days. It will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Oct 16, 2021
@wingrunr21
Copy link
Collaborator

Can you increase your log level in settings to see more details on what is being run? That does look like it isn't detecting the RVM environment correctly.

@wingrunr21 wingrunr21 added need-more-info Awaiting information from author and removed stale labels Oct 17, 2021
@shafy
Copy link
Author

shafy commented Oct 18, 2021

Hey @wingrunr21 yes it looks like it doesn't detect the RVM environment, and I think it's a specific issue to how Gitpod sets up the environment. I'll try to increase the log level and see if it helps. I'm travelling currently and will only get to it in about two weeks, just fyi.

@github-actions
Copy link

This issue has not had activity for 30 days. It will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Dec 18, 2021
@github-actions github-actions bot closed this as completed Jan 2, 2022
@wingrunr21 wingrunr21 reopened this Jan 3, 2022
@wingrunr21 wingrunr21 added bug Bug reports and removed need-more-info Awaiting information from author stale labels Jan 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug reports
Projects
None yet
Development

No branches or pull requests

2 participants