Patch #32296
closed
Added by Masahiro IUCHI about 5 years ago.
Updated 3 months ago.
Category:
Code cleanup/refactoring
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
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
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.
https://bundler.io/v2.0/man/bundle-exec.1.html#Loading
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
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
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
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
Adding updated patch to fix Rubocop offenses
- Status changed from New to Closed
.rubocop.yml
was updated in r22814 to exclude db/migrate/20190510070108_add_unique_id_to_import_items.rb from the offense Rails/BulkChangeTable.
Also available in: Atom
PDF