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
bundle exec
required for running rubocop 1.63.0 and rubocop-rails
#12823
Comments
We are facing a similar issue. On our side the running |
//cc @amomchilov |
ℹ️ This affects github actions. name: Rubocop
on:
pull_request:
branches: [main]
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install rubocop
run: gem install rubocop rubocop-rails rubocop-rspec
- name: Run Rubocop
run: rubocop
|
caac002#diff-ea315f91121985f09990cfdec25432799284584bcf6778086f4dae8f2a0176eaL37 Maybe 👀 lockfile_path ||= defined?(::Bundler) ? ::Bundler.default_lockfile : nil |
Looking into this! |
Fixes the broken reference to `Bundler` on line 66
Fixes the broken reference to `Bundler` on line 66
Apologies for the bug, this didn't get triggered when I tested I fixed this in #12826, which just got merged, hasn't been released yet. Until that's released, you can workaround this bug in 2 ways:
|
Yesterday, all our `pronto` actions started [failing like this](https://github.com/getlago/lago-api/actions/runs/8600901566/job/23566843917?pr=1854). It turned out that there was a bug introduced in rubocop, which made it incompatible with `rubocop-rails`. A [fix](rubocop/rubocop#12826) seems on the way. rubocop/rubocop#12823 One way to mitigate this is to use `bundle exec rubocop` instead of global `rubocop`. We don't have pronto in our Gemfile so let's move to regular rubocop for now. Ideally, we'd like to move to checks like this: #1856 Note: It's necessary to exit if there is no files to run because you can run rubocop on the entire codebase today.
Fixes the broken reference to `Bundler` on line 66
Is there a place where we can get notified when a release is out? I'll need to remove the pin from my Gemfile. A simple solution could be a post in this thread, would help me out 🙏 |
@bmulholland We solved this by using the following pin. Of course, this assumes the next version will fix this.
|
@bmulholland I'll cut a new release within the next hour. |
The new release is out https://github.com/rubocop/rubocop/releases/tag/v1.63.1 |
Expected behavior
Rubocop should run successfully without
bundle exec
within a rails project. It appears this is happening since the cut of1.63.0
,bundle exec rubocop
is expected. If this is now expected behavior (bundle exec
required), the docs should probably be updated.Actual behavior
Running
rubocop
results in auninitialized constant RuboCop::Lockfile::Bundler
error, while runningbundle exec rubocop
completes successfully.Error without bundle exec
Success with bundle exec
It seems to be related to these changes: caac002, where we wouldnt hit the
rescue
since we already checked fordefined?(Bundler)
on line 37Steps to reproduce the problem
rubocop --only Rails --require rubocop-rails
will fail to runbundle exec rubocop --only Rails --require rubocop-rails
will succeedRuboCop version
The text was updated successfully, but these errors were encountered: