question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Verifying setup for RuboCop… bundler: failed to load command: rubocop

See original GitHub issue

Hello,

I’m trying to use this with rubocop, to automatically fix the files, with the following configuration:

      - name: Run lint
        uses: wearerequired/lint-action@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          rubocop: true
          auto_fix: true
          rubocop_args: --fail-level C --display-only-fail-level-offenses
          rubocop_command_prefix: bundle exec

Previous to that I have

jobs:
  run-linters:
    name: Rubocop auto-fix
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.7.1

      - name: Ruby gem cache
        uses: actions/cache@v1
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-
      - name: Install gems
        run: |
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3

When the action runs, it errors with the following message:

Verifying setup for RuboCop…

bundler: failed to load command: rubocop (/home/runner/work/{my_repo}/vendor/bundle/ruby/2.7.0/bin/rubocop)

Error: RuboCop is not installed

I checked the files in verifySetup of rubocop, and it just runs {prefix} rubocop -v, which would be bundle exec rubocop -v in my case.

I made a step in the action with:

      - name: Check bundle version
        run: bundle exec rubocop -v

And it outputs 1.1.0, which is the version my gemfile.lock has. I don’t understand why when the verifySetup of rubocop.js runs that exact same command, it fails and doesn’t work, giving the “failed to load command: rubocop”. Changing the rubocop_dir will output that rubocop is not installed.

Even removing the -v in the last example does run rubocop, although it’s not what I want, because I can’t use this action that way.

Does anybody know what the problem could be?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
KapilSachdevcommented, Nov 4, 2020

I encountered the same issue yesterday. I think this github action does not automatically uses bundle exec. Adding rubocop_command_prefix resolved the issue for me.

      - name: Run linters
        uses: wearerequired/lint-action@v1
        with:
          github_token: ${{ secrets.github_token }}
          rubocop: true
          rubocop_command_prefix: bundle exec
          rubocop_args: -c ./.rubocop.yml
0reactions
github-actions[bot]commented, Jun 9, 2021

A stale label has been added to this issue because it has been open 15 days with no activity. To keep this issue open, add a comment within 5 days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to run RuboCop command - is it installed? · Issue #33
Issue #31 has not been solved with the release of v3.1.0, the plugin fails to load when running rbenv with ruby 2.2.4 and...
Read more >
Rubocop should run on `bundler exec` if available - YouTrack
Setup a project with bundler and rubocop included in the development group but with a different version than installed in the Ruby for...
Read more >
Bundle exec rubocop failling on Github Actions but runs ...
I am trying to setup a CI pipeline using Github Actions. At bundle exec rubocop in my workflow it fails. But the command...
Read more >
Basic Usage :: RuboCop Docs
Code style checker. Running rubocop with no arguments will check all Ruby source files in the current directory: $ rubocop.
Read more >
RuboCop: How to install and configure - SourceLevel
Let's consider here that all your Ruby environment is working, so just execute the following command to install the latest RuboCop version ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found