Skip to content
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

1.6.0 breaks Rubocop run #9196

Closed
morgoth opened this issue Dec 9, 2020 · 14 comments · Fixed by #9197
Closed

1.6.0 breaks Rubocop run #9196

morgoth opened this issue Dec 9, 2020 · 14 comments · Fixed by #9197
Labels

Comments

@morgoth
Copy link

morgoth commented Dec 9, 2020

I have the GH actions set as follow:

name: Rubocop

on:
  pull_request:
    branches:
      - 'master'

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 5

    steps:
    - uses: actions/checkout@v2

    - name: "Checkout master (base is needed to detect changed files)"
      run: git fetch origin master:master --no-tags --quiet --depth 1

    - uses: ruby/setup-ruby@v1

    - name: "Rubocop: install"
      run: gem install -N rubocop rubocop-performance rubocop-rails

    - name: "Rubocop: run"
      run: git diff --diff-filter=ACM --name-only master | xargs rubocop --format s

This now fails with:

--------Error: `Performance` cops have been extracted to the `rubocop-performance` gem.
(obsolete configuration found in .rubocop.yml, please update it)
`Rails` cops have been extracted to the `rubocop-rails` gem.
(obsolete configuration found in .rubocop.yml, please update it)

This is also strange (run locally):

rubocop -v
1.6.0
rubocop -V
Error: `Performance` cops have been extracted to the `rubocop-performance` gem.
(obsolete configuration found in .rubocop.yml, please update it)
`Rails` cops have been extracted to the `rubocop-rails` gem.
(obsolete configuration found in .rubocop.yml, please update it)
bundle exec rubocop -V
1.6.0 (using Parser 2.7.2.0, rubocop-ast 1.3.0, running on ruby 2.7.2 x86_64-linux)
  - rubocop-performance 1.9.1
  - rubocop-rails 2.9.0

So locally it runs fine with bundle exec rubocop but simple rubocop does not work

@morgoth morgoth changed the title 2.6.0 breaks Rubocop run 1.6.0 breaks Rubocop run Dec 9, 2020
@koic koic added the bug label Dec 9, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Dec 9, 2020

Hmm, seems we messed up, but I'm sure we'll manage to sort this out quickly. Seems our warnings didn't factor in the possibility that someone might be using extensions directly without a Gemfile. Sorry about the inconvenience! //cc @dvandersluis

@seandilda
Copy link

For anyone else searching issues, this same issue appears to be affecting Rails cops even when your rubocop.yml is requiring rubocop-rails.

@dvandersluis
Copy link
Member

Looking into it!

@dvandersluis
Copy link
Member

Can anyone who is experiencing this please share your .rubocop.yml requires?

@darylf
Copy link

darylf commented Dec 9, 2020

I'm experiencing this. My require looks like:

  - rubocop-rspec
  - rubocop-performance
  - rubocop-rails

Here is a gist of my entire .rubocop.yml

@dvandersluis
Copy link
Member

dvandersluis commented Dec 9, 2020

@darylf thank you! And you are running rubocop without Bundler?

@morgoth
Copy link
Author

morgoth commented Dec 9, 2020

require:
  - rubocop-performance
  - rubocop-rails

AllCops:
  TargetRubyVersion: 2.7
  DisabledByDefault: true
  NewCops: enable
  # Git submodules
  Exclude:
    - docs/**/*

Performance:
  Enabled: true
Security:
  Enabled: true

# TODO
Performance/CollectionLiteralInLoop:
  Enabled: false

# Lint
Lint/AmbiguousOperator:
  Enabled: true
  Exclude:
    - test/**/*.rb
...
...

As described, it fails when run without a bundler.

@darylf
Copy link

darylf commented Dec 9, 2020

@darylf thank you! And you are running rubocop without Bundler?

Yes, I am running it without bundler. As a github action, as well as locally

@dvandersluis
Copy link
Member

Thanks everyone, I'm putting up a PR to fix this now.

@key88sf
Copy link

key88sf commented Dec 9, 2020

Any ETA on when this will be live/fixed? Currently can't build anything due to this bug.

@dvandersluis
Copy link
Member

@key88sf can you lock your build to 1.5.2 until this is resolved? I imagine @bbatsov will release 1.6.1 pretty quickly once this is fixed.

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 9, 2020

Yeah, that's my plan. I'm just waiting for a green build on the PR.

dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Dec 9, 2020
…for loaded features when bundler is not activated.
bbatsov pushed a commit that referenced this issue Dec 9, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Dec 9, 2020

I've merged the fix and I'll cut a new release tomorrow, so I can give you the opportunity to test it by building the gem from master. Huge thanks to @dvandersluis for instantly jumping on this and fixing it! 🏆 🥇

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 10, 2020

1.6.1 is out https://github.com/rubocop-hq/rubocop/releases/tag/v1.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
7 participants