Actions
Patch #32296
closedIgnore rubocop offense
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Code cleanup/refactoring
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Description
I found a rubocop offense is remaining.
$ rubocop db/migrate/20190510070108_add_unique_id_to_import_items.rb Inspecting 1 file C Offenses: db/migrate/20190510070108_add_unique_id_to_import_items.rb:3:5: C: Rails/BulkChangeTable: You can combine alter queries using bulk: true options. change_table :import_items do |t| ^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected
Environment information:
$ RAILS_ENV=test bin/about Environment: Redmine version 4.0.4.devel.18732 Ruby version 2.5.5-p157 (2019-03-15) [x86_64-darwin19] Rails version 5.2.3 Environment test Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::InlineAdapter Mailer delivery test SCM: Subversion 1.10.4 Git 2.21.0 Filesystem Redmine plugins: no plugin installed
I have created a patch to ignore it like other migration files.
Files
Updated by Go MAEDA about 5 years ago
I run RuboCop against r18732 but was not able to reproduce the warning.
$ bundle exec rubocop db/migrate/20190510070108_add_unique_id_to_import_items.rb Inspecting 1 file . 1 file inspected, no offenses detected
Updated by Masahiro IUCHI about 5 years ago
Reproduced it with BUNDLE_DISABLE_EXEC_LOAD=1 when using bundler.
$ BUNDLE_DISABLE_EXEC_LOAD=1 bundle exec rubocop db/migrate/20190510070108_add_unique_id_to_import_items.rb Inspecting 1 file C Offenses: db/migrate/20190510070108_add_unique_id_to_import_items.rb:3:5: C: Rails/BulkChangeTable: You can combine alter queries using bulk: true options. change_table :import_items do |t| ^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected
I think this is a rare case written in bundler's documentation.
Updated by Go MAEDA about 5 years ago
Thank you for the feedback. But I still cannot see the warning.
$ ruby -v ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18] $ bundler -v Bundler version 2.0.2 $ bundle update --quiet $ BUNDLE_DISABLE_EXEC_LOAD=1 bundle exec rubocop db/migrate/20190510070108_add_unique_id_to_import_items.rb Inspecting 1 file . 1 file inspected, no offenses detected
Updated by Masahiro IUCHI about 5 years ago
Sorry, BUNDLE_DISABLE_EXEC_LOAD was not related with this behavior.
Please execute rubocop command with "--cache false" option.
$ bundle exec rubocop --cache false db/migrate/20190510070108_add_unique_id_to_import_items.rb Inspecting 1 file C Offenses: db/migrate/20190510070108_add_unique_id_to_import_items.rb:3:5: C: Rails/BulkChangeTable: You can combine alter queries using bulk: true options. change_table :import_items do |t| ^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected
Updated by Go MAEDA about 5 years ago
I don't know the cause, but I still cannot reproduce the warning in my environment.
$ svn info --show-item revision 18898 $ bundle exec rubocop --version 0.76.0 $ bundle exec rubocop --cache false db/migrate/20190510070108_add_unique_id_to_import_items.rb Inspecting 1 file . 1 file inspected, no offenses detected
Updated by Paolo Lim about 4 years ago
I can replicate this issue
$ rubocop db/migrate/20190510070108_add_unique_id_to_import_items.rb Inspecting 1 file C Offenses: db/migrate/20190510070108_add_unique_id_to_import_items.rb:3:5: C: Rails/BulkChangeTable: You can combine alter queries using bulk: true options. change_table :import_items do |t| ^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected
$ RAILS_ENV=test bin/about Environment: Redmine version 4.1.1.devel Ruby version 2.6.5-p114 (2019-10-01) [x86_64-linux] Rails version 5.2.4.4 Environment test Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::InlineAdapter Mailer delivery sendmail SCM: Subversion 1.9.7 Git 2.17.1 Filesystem Redmine plugins: no plugin installed
Updated by Paolo Lim about 4 years ago
Adding updated patch to fix Rubocop offenses
Actions