From 027a1d4d6365ced289d4b8600f4820844557af32 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 18 Feb 2021 17:23:33 +0100 Subject: [PATCH] Maintenance: Updated rubocop(-* gems) to latest version (1.10.0). --- Gemfile.lock | 6 +++--- app/controllers/monitoring_controller.rb | 2 +- app/models/channel/driver/imap.rb | 2 +- lib/core_ext/active_record/calculations/pluck_as_hash.rb | 4 +++- test/browser/admin_object_manager_test.rb | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d77a55868..3a0a35bc5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -248,7 +248,7 @@ GEM http-form_data (2.1.1) http_parser.rb (0.6.0) httpclient (2.8.3) - i18n (1.8.8) + i18n (1.8.9) concurrent-ruby (~> 1.0) icalendar (2.5.3) ice_cube (~> 0.16) @@ -454,7 +454,7 @@ GEM rspec-support (~> 3.9.0) rspec-support (3.9.3) rszr (0.5.2) - rubocop (1.9.1) + rubocop (1.10.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) @@ -472,7 +472,7 @@ GEM activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 0.90.0, < 2.0) - rubocop-rspec (2.1.0) + rubocop-rspec (2.2.0) rubocop (~> 1.0) rubocop-ast (>= 1.1.0) ruby-progressbar (1.11.0) diff --git a/app/controllers/monitoring_controller.rb b/app/controllers/monitoring_controller.rb index ddd587960..d3e2bf8ea 100644 --- a/app/controllers/monitoring_controller.rb +++ b/app/controllers/monitoring_controller.rb @@ -119,7 +119,7 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX handler_attempts_map[job_name][:attempts] += job.attempts end - Hash[handler_attempts_map.sort].each_with_index do |(job_name, job_data), index| + handler_attempts_map.sort.to_h.each_with_index do |(job_name, job_data), index| issues.push "Failed to run background job ##{index + 1} '#{job_name}' #{job_data[:count]} time(s) with #{job_data[:attempts]} attempt(s)." end diff --git a/app/models/channel/driver/imap.rb b/app/models/channel/driver/imap.rb index bdeb92024..c665043c7 100644 --- a/app/models/channel/driver/imap.rb +++ b/app/models/channel/driver/imap.rb @@ -411,7 +411,7 @@ returns array.each { |elem| elem.append(nil) if elem.one? } - Hash[*array.flatten] + Hash[*array.flatten] # rubocop:disable Style/HashConversion end # Parses RFC822 header diff --git a/lib/core_ext/active_record/calculations/pluck_as_hash.rb b/lib/core_ext/active_record/calculations/pluck_as_hash.rb index 5407dd65b..ddb2b549e 100644 --- a/lib/core_ext/active_record/calculations/pluck_as_hash.rb +++ b/lib/core_ext/active_record/calculations/pluck_as_hash.rb @@ -26,7 +26,9 @@ module ActiveRecord def pluck_as_hash_map(keys, values) if keys.one? - Hash[keys.first, values] + { + keys.first => values + } else keys.zip(values).to_h end diff --git a/test/browser/admin_object_manager_test.rb b/test/browser/admin_object_manager_test.rb index d5e998773..090e048ac 100644 --- a/test/browser/admin_object_manager_test.rb +++ b/test/browser/admin_object_manager_test.rb @@ -597,7 +597,7 @@ class AdminObjectManagerTest < TestCase # lexicographically ordered list of option strings options = %w[0 000.000 1 100.100 100.200 2 200.100 200.200 3 ä b n ö p sr ß st t ü v] - options_hash = Hash[options.reverse.collect { |o| [o, o] }] + options_hash = options.reverse.collect { |o| [o, o] }.to_h object_manager_attribute_create( data: { @@ -678,7 +678,7 @@ class AdminObjectManagerTest < TestCase url: browser_url, ) - options = Hash[ %w[äöü cat delete dog ß].map { |x| [x, "#{x.capitalize} Display"] } ] + options = %w[äöü cat delete dog ß].map { |x| [x, "#{x.capitalize} Display"] }.to_h options_no_dog = options.except('dog') options_no_dog_no_delete = options_no_dog.except('delete')