Rubocop: 1.6.0 breaks Rubocop run

Created on 9 Dec 2020  路  14Comments  路  Source: rubocop-hq/rubocop

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

bug

Most helpful comment

Looking into it!

All 14 comments

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

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

Looking into it!

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

I'm experiencing this. My require looks like:

``` require:

  • rubocop-rspec
  • rubocop-performance
  • rubocop-rails
    ```
    Here is a gist of my entire .rubocop.yml

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

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 thank you! And you are running rubocop without Bundler?

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

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

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

@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.

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

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! 馃弳 馃

Was this page helpful?
0 / 5 - 0 ratings