Maintenance: Bump rubocop from 1.23.0 to 1.24.1

Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.23.0 to 1.24.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.23.0...v1.24.1)
This commit is contained in:
Martin Gruner 2022-01-03 08:21:16 +01:00
parent 2393fc85f2
commit 2c4ca0adfa
13 changed files with 23 additions and 31 deletions

View file

@ -502,13 +502,13 @@ GEM
rspec-support (~> 3.10) rspec-support (~> 3.10)
rspec-support (3.10.2) rspec-support (3.10.2)
rszr (0.5.2) rszr (0.5.2)
rubocop (1.23.0) rubocop (1.24.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.0.0.0) parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml rexml
rubocop-ast (>= 1.12.0, < 2.0) rubocop-ast (>= 1.15.1, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.15.1) rubocop-ast (1.15.1)

View file

@ -18,8 +18,7 @@ module HasPublishing
params_for_update = params params_for_update = params
.permit(:id, :internal_at, :published_at, :archived_at) .permit(:id, :internal_at, :published_at, :archived_at)
.to_h .to_h
.map { |k, v| [k.to_sym, v == '--now--' ? Time.zone.now : v] } .to_h { |k, v| [k.to_sym, v == '--now--' ? Time.zone.now : v] }
.to_h
model_update_render(klass, params_for_update) model_update_render(klass, params_for_update)
end end

View file

@ -33,8 +33,7 @@ module KnowledgeBaseRichTextHelper
settings = match settings = match
.slice(1...-1) .slice(1...-1)
.split(',') .split(',')
.map { |pair| pair.split(':').map(&:strip) } .to_h { |pair| pair.split(':').map(&:strip) }
.to_h
.symbolize_keys .symbolize_keys
url = case settings[:provider] url = case settings[:provider]

View file

@ -93,9 +93,9 @@ returns
data = YAML.load_file(Rails.root.join('config/holiday_calendars.yml')) data = YAML.load_file(Rails.root.join('config/holiday_calendars.yml'))
url = data['url'] url = data['url']
data['countries'].map do |country, domain| data['countries'].to_h do |country, domain|
[format(url, domain: domain), country] [format(url, domain: domain), country]
end.to_h end
end end
=begin =begin

View file

@ -561,7 +561,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
end end
def message_header_hash(mail) def message_header_hash(mail)
imported_fields = mail.header.fields.map do |f| imported_fields = mail.header.fields.to_h do |f|
begin begin
value = if f.value.match?(ISO2022JP_REGEXP) value = if f.value.match?(ISO2022JP_REGEXP)
value = header_field_unpack_japanese(f) value = header_field_unpack_japanese(f)
@ -582,7 +582,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
value = f.decoded.to_utf8(fallback: :read_as_sanitized_binary) value = f.decoded.to_utf8(fallback: :read_as_sanitized_binary)
end end
[f.name.downcase, value] [f.name.downcase, value]
end.to_h end
# imported_fields = mail.header.fields.map { |f| [f.name.downcase, f.to_utf8] }.to_h # imported_fields = mail.header.fields.map { |f| [f.name.downcase, f.to_utf8] }.to_h
raw_fields = mail.header.fields.index_by { |f| "raw-#{f.name.downcase}" } raw_fields = mail.header.fields.index_by { |f| "raw-#{f.name.downcase}" }
@ -910,9 +910,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
md5 = Digest::MD5.hexdigest(msg) md5 = Digest::MD5.hexdigest(msg)
file_path = Rails.root.join('tmp', folder, "#{md5}.eml") file_path = Rails.root.join('tmp', folder, "#{md5}.eml")
File.open(file_path, 'wb') do |file| File.binwrite(file_path, msg)
file.write msg
end
file_path file_path
end end

View file

@ -211,9 +211,7 @@ returns
if !path if !path
path = Rails.root.join('tmp', filename) path = Rails.root.join('tmp', filename)
end end
::File.open(path, 'wb') do |handle| ::File.binwrite(path, file.content)
handle.write file.content
end
path path
end end

View file

@ -25,9 +25,9 @@ class Sequencer
def mapped def mapped
@mapped ||= begin @mapped ||= begin
resource_with_indifferent_access = resource.with_indifferent_access resource_with_indifferent_access = resource.with_indifferent_access
mapping.symbolize_keys.collect do |source, local| mapping.symbolize_keys.to_h do |source, local|
[local, resource_with_indifferent_access[source]] [local, resource_with_indifferent_access[source]]
end.to_h.with_indifferent_access end.with_indifferent_access
end end
end end

View file

@ -35,12 +35,12 @@ class Sequencer
end end
def folder_total_map def folder_total_map
ews_folder_ids.collect do |folder_id| ews_folder_ids.to_h do |folder_id|
folder = ews_folder.find(folder_id) folder = ews_folder.find(folder_id)
display_path = ews_folder.display_path(folder) display_path = ews_folder.display_path(folder)
[display_path, folder.total_count] [display_path, folder.total_count]
end.to_h end
end end
end end
end end

View file

@ -16,12 +16,12 @@ class Sequencer
return {} if custom_fields.blank? return {} if custom_fields.blank?
custom_fields.select { |custom_field| ticket_field_map[ custom_field['id'] ].present? } custom_fields.select { |custom_field| ticket_field_map[ custom_field['id'] ].present? }
.map do |custom_field| .to_h do |custom_field|
[ [
ticket_field_map[ custom_field['id'] ].to_sym, # remote_name ticket_field_map[ custom_field['id'] ].to_sym, # remote_name
custom_field['value'] custom_field['value']
] ]
end.to_h end
end end
end end
end end

View file

@ -20,9 +20,7 @@ class Sessions::Store::File
# store session data in session file # store session data in session file
FileUtils.mkpath path_tmp FileUtils.mkpath path_tmp
File.open(session_file, 'wb') do |file| File.binwrite(session_file, content)
file.write content
end
# destroy old session if needed # destroy old session if needed
if File.exist?(path) if File.exist?(path)

View file

@ -88,7 +88,7 @@ RSpec.describe 'User endpoint', type: :request do
context 'parameter groups' do context 'parameter groups' do
let(:group_names_access_map) do let(:group_names_access_map) do
Group.all.map { |g| [g.name, ['full']] }.to_h Group.all.to_h { |g| [g.name, ['full']] }
end end
let(:payload) do let(:payload) do
@ -103,7 +103,7 @@ RSpec.describe 'User endpoint', type: :request do
context 'parameter group_ids' do context 'parameter group_ids' do
let(:group_ids_access_map) do let(:group_ids_access_map) do
Group.all.map { |g| [g.id, ['full']] }.to_h Group.all.to_h { |g| [g.id, ['full']] }
end end
let(:payload) do let(:payload) do
@ -436,7 +436,7 @@ RSpec.describe 'User endpoint', type: :request do
let(:privileged) do let(:privileged) do
{ {
groups: Group.all.map { |g| [g.name, ['full']] }.to_h groups: Group.all.to_h { |g| [g.name, ['full']] }
} }
end end
@ -448,7 +448,7 @@ RSpec.describe 'User endpoint', type: :request do
let(:privileged) do let(:privileged) do
{ {
group_ids: Group.all.map { |g| [g.id, ['full']] }.to_h group_ids: Group.all.to_h { |g| [g.id, ['full']] }
} }
end end

View file

@ -167,7 +167,7 @@ RSpec.describe 'System > Objects', type: :system do
context 'when checking field sorting', db_strategy: :reset do context 'when checking field sorting', db_strategy: :reset do
# lexicographically ordered list of option strings # lexicographically ordered list of option strings
let(:options) { %w[0 000.000 1 100.100 100.200 2 200.100 200.200 3 ä b n ö p sr ß st t ü v] } let(:options) { %w[0 000.000 1 100.100 100.200 2 200.100 200.200 3 ä b n ö p sr ß st t ü v] }
let(:options_hash) { options.reverse.collect { |o| [o, o] }.to_h } let(:options_hash) { options.reverse.to_h { |o| [o, o] } }
let(:object_attribute) do let(:object_attribute) do
attribute = create(:object_manager_attribute_select, data_option: { options: options_hash, default: 0 }, position: 999) attribute = create(:object_manager_attribute_select, data_option: { options: options_hash, default: 0 }, position: 999)

View file

@ -4681,7 +4681,7 @@ wait untill text in selector disabppears
=end =end
def set_setting(name, value) def set_setting(name, value)
name_to_id = fetch_settings.map { |s| [s['name'], s['id']] }.to_h name_to_id = fetch_settings.to_h { |s| [s['name'], s['id']] }
id = name_to_id[name] id = name_to_id[name]
url = URI.parse(browser_url) url = URI.parse(browser_url)