-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Description
#12848 (comment) mentions a problem with bundler not being used anymore if rubocop is run globally. This indeed causes a regression with e.g. rubocop-rails, see https://github.com/rubocop/rubocop-rails/blob/28b274bcd14da7d8c861aaf9dcdbe165d9fc28f2/lib/rubocop/cop/rails/reversible_migration.rb#L293C1-L293C84
I suspect target_rails_version to not return the installed Rails version anymore. Which makes sense because the Gemfile.lock is not parsed anymore. However, we use rubocop globally in CI. Why would I want to install the bundle everytime?
I don't think that this change should be made quietly in a patch version update. If this is intentional, this is a big thing that should at least be announced.
Expected behavior
sh-5.2$ rubocop _1.63.1_ db/migrate/20220915105426_remove_columns_from_order_items.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
sh-5.2$ bundle exec rubocop db/migrate/20220915105426_remove_columns_from_order_items.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
Actual behavior
sh-5.2$ rubocop _1.63.3_ db/migrate/20220915105426_remove_columns_from_order_items.rb
Inspecting 1 file
C
Offenses:
db/migrate/20220915105426_remove_columns_from_order_items.rb:5:7: C: Rails/ReversibleMigration: t.remove is not reversible.
t.remove :delivery_date, type: :datetime
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 file inspected, 1 offense detected
Steps to reproduce the problem
sh-5.2$ cat db/migrate/20220915105426_remove_columns_from_order_items.rb
class RemoveColumnsFromOrderItems < ActiveRecord::Migration[7.0]
def change
change_table :order_items, bulk: true do |t|
t.remove :delivery_date, type: :datetime
end
end
end
RuboCop version
sh-5.2$ rubocop _1.63.3_ -V
1.63.3 (using Parser 3.3.0.5, rubocop-ast 1.31.2, running on ruby 3.3.0) [x86_64-linux]
- rubocop-factory_bot 2.25.1
- rubocop-performance 1.21.0
- rubocop-rails 2.24.1
- rubocop-rspec 2.29.1
sh-5.2$ bundle exec rubocop -V
1.63.3 (using Parser 3.3.0.5, rubocop-ast 1.31.2, running on ruby 3.3.0) [x86_64-linux]
- rubocop-factory_bot 2.25.1
- rubocop-performance 1.21.0
- rubocop-rails 2.24.1
- rubocop-rspec 2.29.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels