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

Regression: rubocop 1.45.0 crashes when we use rubocop-i18n #11549

Closed
Tietew opened this issue Feb 8, 2023 · 1 comment · Fixed by #11550
Closed

Regression: rubocop 1.45.0 crashes when we use rubocop-i18n #11549

Tietew opened this issue Feb 8, 2023 · 1 comment · Fixed by #11550
Labels

Comments

@Tietew
Copy link
Contributor

Tietew commented Feb 8, 2023

After upgrading rubocop 1.45.0, rubocop crashes:

$ bundle exec rubocop
NoMethodError: private method `begin_investigation' called for #<RuboCop::Cop::I18n::RailsI18n::DecorateStringFormattingUsingInterpolation:(...snip...)>
.../rubocop-1.45.0/lib/rubocop/cop/commissioner.rb:100:in `block in begin_investigation'
.../rubocop-1.45.0/lib/rubocop/cop/commissioner.rb:99:in `each'
.../rubocop-1.45.0/lib/rubocop/cop/commissioner.rb:99:in `begin_investigation'
...

This seems to be introduced at 3c9c494.

Before:

@cops.each { |cop| cop.send :begin_investigation, processed_source }

After:

@cops.each do |cop|
  cop.begin_investigation(processed_source, offset: offset, original: original)
end

RuboCop::Cop::Base#begin_investigation is moved to public section,
but RuboCop::Cop::Cop#begin_investigation is still in private section.
rubocop-i18n's cops are extended from RuboCop::Cop::Cop instead of Base.


Expected behavior

Rubocop works with no errors.

Actual behavior

Rubocop crashes.

Steps to reproduce the problem

$ bundle init
$ bundle add rubocop rubocop-i18n
$ echo "require: [rubocop-i18n]" > .rubocop.yml
$ bundle exec rubocop

RuboCop version

1.45.0 (using Parser 3.2.0.0, rubocop-ast 1.24.1, running on ruby 3.1.3) [x86_64-linux]
  - rubocop-i18n 1.12.0
@koic koic added the bug label Feb 8, 2023
koic added a commit to koic/rubocop that referenced this issue Feb 8, 2023
Fixes rubocop#11549.

This PR fixes an error for third party cops when inheriting `RuboCop::Cop::Cop`.
It makes the same changes to `RuboCop::Cop::Cop` as `RuboCop::Cop::Base` in rubocop#10839.
Confirmed that rubocop-i18n tests pass again.
@kerby82
Copy link

kerby82 commented Feb 8, 2023

Same issue in our build/test pipeline. It's blocking our ability to merge code. Can be this fixed soon please?

instructure-gerrit pushed a commit to instructure/canvas-lms that referenced this issue Feb 8, 2023
this is a temporary version lock to avoid a bug in rubocop 1.45.0
rubocop/rubocop#11549

Change-Id: Ibc0f90c6d3ebaaa0857e2e8b265d2a6585e9fe17
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/310676
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
Product-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
Build-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
bbatsov pushed a commit that referenced this issue Feb 8, 2023
Fixes #11549.

This PR fixes an error for third party cops when inheriting `RuboCop::Cop::Cop`.
It makes the same changes to `RuboCop::Cop::Cop` as `RuboCop::Cop::Base` in #10839.
Confirmed that rubocop-i18n tests pass again.
benlangfeld added a commit to powerhome/power-tools that referenced this issue Feb 8, 2023
The bug that caused all the drama [was fixed already](rubocop/rubocop#11549).
that-jill pushed a commit to powerhome/power-tools that referenced this issue Feb 8, 2023
* Allow new rubocop versions

The bug that caused all the drama [was fixed already](rubocop/rubocop#11549).

* Version bump

* Bump lockfiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants