From e5dc99deeae9ed7406ee1691be00f7da5bf46acc Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 2 Mar 2021 07:26:51 +0000 Subject: [PATCH] Maintenance: Updated rubocop(-* gems) to latest version (1.11.0). --- Gemfile.lock | 6 +++--- app/controllers/form_controller.rb | 2 +- app/controllers/tickets_controller.rb | 2 +- app/models/application_model/can_assets.rb | 2 +- app/models/application_model/can_creates_and_updates.rb | 2 +- app/models/channel/driver/imap.rb | 2 +- app/models/chat.rb | 4 +--- app/models/ticket.rb | 8 ++++---- lib/search_index_backend.rb | 2 +- 9 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1c6eb5cb3..739bb18bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -292,7 +292,7 @@ GEM mini_portile2 (2.5.0) mini_racer (0.2.9) libv8 (>= 6.9.411) - minitest (5.14.3) + minitest (5.14.4) msgpack (1.2.4) multi_json (1.15.0) multi_xml (0.6.0) @@ -455,7 +455,7 @@ GEM rspec-support (~> 3.9.0) rspec-support (3.9.3) rszr (0.5.2) - rubocop (1.10.0) + rubocop (1.11.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) @@ -466,7 +466,7 @@ GEM unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.4.1) parser (>= 2.7.1.5) - rubocop-performance (1.9.2) + rubocop-performance (1.10.0) rubocop (>= 0.90.0, < 2.0) rubocop-ast (>= 0.4.0) rubocop-rails (2.9.1) diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index e2a3cc334..67f2e8ac9 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -174,7 +174,7 @@ class FormController < ApplicationController Rails.logger.info 'Invalid token for form!' raise Exceptions::NotAuthorized end - parts = result.split(/:/) + parts = result.split(':') if parts.count != 3 Rails.logger.info "Invalid token for form (need to have 3 parts, only #{parts.count} found)!" raise Exceptions::NotAuthorized diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 6f690f71c..a28245ca5 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -157,7 +157,7 @@ class TicketsController < ApplicationController # create tags if given if params[:tags].present? - tags = params[:tags].split(/,/) + tags = params[:tags].split(',') tags.each do |tag| ticket.tag_add(tag) end diff --git a/app/models/application_model/can_assets.rb b/app/models/application_model/can_assets.rb index 8aeae3de6..035e5f37b 100644 --- a/app/models/application_model/can_assets.rb +++ b/app/models/application_model/can_assets.rb @@ -61,7 +61,7 @@ get assets and record_ids of selector # get assets of condition models = Models.all send(selector).each do |item, content| - attribute = item.split(/\./) + attribute = item.split('.') next if !attribute[1] begin diff --git a/app/models/application_model/can_creates_and_updates.rb b/app/models/application_model/can_creates_and_updates.rb index 2830a4652..35ab4ecb3 100644 --- a/app/models/application_model/can_creates_and_updates.rb +++ b/app/models/application_model/can_creates_and_updates.rb @@ -80,7 +80,7 @@ returns def case_sensitive_find_by(**attrs) return nil if attrs.empty? - return find_by(**attrs) if Rails.application.config.db_case_sensitive || attrs.values.none? { |v| v.is_a?(String) } + return find_by(**attrs) if Rails.application.config.db_case_sensitive || attrs.values.none?(String) where(**attrs).find { |record| record[attrs.keys.first] == attrs.values.first } end diff --git a/app/models/channel/driver/imap.rb b/app/models/channel/driver/imap.rb index c665043c7..bdeb92024 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] # rubocop:disable Style/HashConversion + Hash[*array.flatten] end # Parses RFC822 header diff --git a/app/models/chat.rb b/app/models/chat.rb index 9463d7b5a..5c8069441 100644 --- a/app/models/chat.rb +++ b/app/models/chat.rb @@ -651,9 +651,7 @@ check if country is blocked for chat return false if geo_ip['country_code'].blank? countries = block_country.split(';') - countries.any? do |local_country| - geo_ip['country_code'] == local_country - end + countries.any?(geo_ip['country_code']) end end diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 7eebd3f58..2e5727e54 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -575,7 +575,7 @@ condition example # get tables to join tables = '' selectors.each_key do |attribute| - selector = attribute.split(/\./) + selector = attribute.split('.') next if !selector[1] next if selector[0] == 'ticket' next if selector[0] == 'execution_time' @@ -630,7 +630,7 @@ condition example return nil if selector['pre_condition'] && selector['pre_condition'] !~ /^(not_set|current_user\.|specific)/ # get attributes - attributes = attribute.split(/\./) + attributes = attribute.split('.') attribute = "#{ActiveRecord::Base.connection.quote_table_name("#{attributes[0]}s")}.#{ActiveRecord::Base.connection.quote_column_name(attributes[1])}" # magic selectors @@ -639,7 +639,7 @@ condition example end if attributes[0] == 'ticket' && attributes[1] == 'tags' - selector['value'] = selector['value'].split(/,/).collect(&:strip) + selector['value'] = selector['value'].split(',').collect(&:strip) end if selector['operator'].include?('in working time') @@ -993,7 +993,7 @@ perform changes on ticket if key == 'ticket.tags' next if value['value'].blank? - tags = value['value'].split(/,/) + tags = value['value'].split(',') case value['operator'] when 'add' tags.each do |tag| diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb index 8e69ac972..3cee95df5 100644 --- a/lib/search_index_backend.rb +++ b/lib/search_index_backend.rb @@ -491,7 +491,7 @@ example for aggregations within one year if selector.present? selector.each do |key, data| data = data.clone - table, key_tmp = key.split(/\./) + table, key_tmp = key.split('.') if key_tmp.blank? key_tmp = table table = 'ticket'