From 56489cdc4f0d96202dda3c3f688295e8dabb66ee Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 28 Feb 2023 08:59:19 -0500 Subject: [PATCH] Autofix Rubocop Style/HashConversion (#23852) --- .rubocop_todo.yml | 7 ------- app/services/import_service.rb | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8cd4afa5a..22e1a99c1 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -2056,13 +2056,6 @@ Style/HashAsLastArrayItem: - 'app/services/notify_service.rb' - 'db/migrate/20181024224956_migrate_account_conversations.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowSplatArgument. -Style/HashConversion: - Exclude: - - 'app/services/import_service.rb' - # Offense count: 12 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. diff --git a/app/services/import_service.rb b/app/services/import_service.rb index 7a68e4ca3..940c236d4 100644 --- a/app/services/import_service.rb +++ b/app/services/import_service.rb @@ -67,7 +67,7 @@ class ImportService < BaseService def import_relationships!(action, undo_action, overwrite_scope, limit, extra_fields = {}) local_domain_suffix = "@#{Rails.configuration.x.local_domain}" - items = @data.take(limit).map { |row| [row['Account address']&.strip&.delete_suffix(local_domain_suffix), Hash[extra_fields.map { |key, field_settings| [key, row[field_settings[:header]]&.strip || field_settings[:default]] }]] }.reject { |(id, _)| id.blank? } + items = @data.take(limit).map { |row| [row['Account address']&.strip&.delete_suffix(local_domain_suffix), extra_fields.to_h { |key, field_settings| [key, row[field_settings[:header]]&.strip || field_settings[:default]] }] }.reject { |(id, _)| id.blank? } if @import.overwrite? presence_hash = items.each_with_object({}) { |(id, extra), mapping| mapping[id] = [true, extra] }