diff options
Diffstat (limited to 'rubocop/cop/migration/schedule_async.rb')
-rw-r--r-- | rubocop/cop/migration/schedule_async.rb | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/rubocop/cop/migration/schedule_async.rb b/rubocop/cop/migration/schedule_async.rb index 74bd2baffa9..f31bfa46aa7 100644 --- a/rubocop/cop/migration/schedule_async.rb +++ b/rubocop/cop/migration/schedule_async.rb @@ -11,9 +11,8 @@ module RuboCop ENFORCED_SINCE = 2020_02_12_00_00_00 MSG = <<~MSG - Don't call the background migration worker directly, use the `#migrate_async`, - `#migrate_in`, `#bulk_migrate_async` or `#bulk_migrate_in` migration helpers - instead. + Don't call the background migration worker directly, use the `#migrate_in` or + `#queue_background_migration_jobs_by_range_at_intervals` migration helpers instead. MSG def_node_matcher :calls_background_migration_worker?, <<~PATTERN @@ -26,28 +25,6 @@ module RuboCop add_offense(node, location: :expression) if calls_background_migration_worker?(node) end - - def autocorrect(node) - # This gets rid of the receiver `BackgroundMigrationWorker` and - # replaces `perform` with `schedule` - schedule_method = method_name(node).to_s.sub('perform', 'migrate') - arguments = arguments(node).map(&:source).join(', ') - - replacement = "#{schedule_method}(#{arguments})" - lambda do |corrector| - corrector.replace(node.source_range, replacement) - end - end - - private - - def method_name(node) - node.children.second - end - - def arguments(node) - node.children[2..] - end end end end |