From 3e2ad0e19cfde2faf0267511434a4b2eddf8fafa Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Tue, 14 Sep 2021 09:46:08 +0200 Subject: [PATCH] Maintenance: Bump rubocop from 1.20.0 to 1.21.0 --- Gemfile.lock | 4 ++-- app/controllers/form_controller.rb | 2 +- app/models/knowledge_base.rb | 2 +- db/migrate/20200205000001_chat_add_allow_website.rb | 2 +- db/migrate/20210712101116_inclusive_wording.rb | 2 +- lib/core_ext/string.rb | 3 --- lib/import/otrs.rb | 2 +- .../unit/import/common/object_attribute/sanitized_name.rb | 2 -- lib/stats/ticket_waiting_time.rb | 2 +- lib/twitter_sync.rb | 2 -- spec/models/ticket_spec.rb | 8 ++++---- 11 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f1b00de0d..4f7e043dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -397,7 +397,7 @@ GEM childprocess (>= 0.6.3, < 5) iniparse (~> 1.4) rexml (~> 3.2) - parallel (1.20.1) + parallel (1.21.0) parser (3.0.2.0) ast (~> 2.4.1) pg (0.21.0) @@ -499,7 +499,7 @@ GEM rspec-support (~> 3.10) rspec-support (3.10.2) rszr (0.5.2) - rubocop (1.20.0) + rubocop (1.21.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 5afd71507..b86d42566 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -192,7 +192,7 @@ class FormController < ApplicationController Rails.logger.info "Invalid token for form (invalid fingerprint found #{fingerprint_local} != #{fingerprint})!" raise Exceptions::NotAuthorized end - if parts[1].to_i < (Time.zone.now.to_i - 60 * 60 * 24) + if parts[1].to_i < (Time.zone.now.to_i - (60 * 60 * 24)) Rails.logger.info 'Invalid token for form (token expired})!' raise Exceptions::NotAuthorized end diff --git a/app/models/knowledge_base.rb b/app/models/knowledge_base.rb index 7c1389a80..fac0bfec9 100644 --- a/app/models/knowledge_base.rb +++ b/app/models/knowledge_base.rb @@ -91,7 +91,7 @@ class KnowledgeBase < ApplicationModel def custom_address_prefix(request) host = custom_address_uri.host || request.headers.env['SERVER_NAME'] port = request.headers.env['SERVER_PORT'] - port_silent = request.ssl? && port == '443' || !request.ssl? && port == '80' + port_silent = (request.ssl? && port == '443') || (!request.ssl? && port == '80') port_string = port_silent ? '' : ":#{port}" "#{custom_address_uri.scheme}://#{host}#{port_string}" diff --git a/db/migrate/20200205000001_chat_add_allow_website.rb b/db/migrate/20200205000001_chat_add_allow_website.rb index fd1105622..d8a7b8b11 100644 --- a/db/migrate/20200205000001_chat_add_allow_website.rb +++ b/db/migrate/20200205000001_chat_add_allow_website.rb @@ -6,6 +6,6 @@ class ChatAddAllowWebsite < ActiveRecord::Migration[5.1] # return if it's a new setup return if !Setting.exists?(name: 'system_init_done') - add_column :chats, :whitelisted_websites, :string, limit: 5000, null: true # rubocop:disable Naming/InclusiveLanguage + add_column :chats, :whitelisted_websites, :string, limit: 5000, null: true end end diff --git a/db/migrate/20210712101116_inclusive_wording.rb b/db/migrate/20210712101116_inclusive_wording.rb index b82fdd976..10e350eb4 100644 --- a/db/migrate/20210712101116_inclusive_wording.rb +++ b/db/migrate/20210712101116_inclusive_wording.rb @@ -6,7 +6,7 @@ class InclusiveWording < ActiveRecord::Migration[6.0] # return if it's a new setup return if !Setting.exists?(name: 'system_init_done') - rename_column :chats, :whitelisted_websites, :allowed_websites # rubocop:disable Naming/InclusiveLanguage + rename_column :chats, :whitelisted_websites, :allowed_websites Chat.reset_column_information end end diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb index 053d9f035..def90bda2 100644 --- a/lib/core_ext/string.rb +++ b/lib/core_ext/string.rb @@ -417,7 +417,6 @@ class String map['otrs-en-de'] = '^.{6,10}[[:space:]].{3,10}[[:space:]]-[[:space:]].{1,250}[[:space:]](wrote|schrieb):' # Ms - # rubocop:disable Style/AsciiComments # From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc] # Send: Donnerstag, 2. April 2015 10:00 # To/Cc/Bcc: xxx @@ -432,8 +431,6 @@ class String # À/?/?: xxx # Envoyé : mercredi 29 avril 2015 17:31 # Objet : xxx - # rubocop:enable Style/AsciiComments - # en/de/fr | sometimes ms adds a space to "xx : value" map['ms-en-de-fr_from'] = '^(Von|From|De|от|Z|Od|Ze|Fra|Van|Mistä|Από|Dal|から|Из|од|iz|Från|จาก|з|Từ)( ?):[[:space:]].+?' map['ms-en-de-fr_from_html'] = "\n######b######(From|Von|De)([[:space:]]?):([[:space:]]?)(######\/b######)[[:space:]].+?" diff --git a/lib/import/otrs.rb b/lib/import/otrs.rb index a999aed19..3b1efb2b4 100644 --- a/lib/import/otrs.rb +++ b/lib/import/otrs.rb @@ -82,7 +82,7 @@ module Import # get the offset for the current thread and loop count thread_offset_base = (Thread.current[:thread_no] - 1) * limit thread_step = thread_count * limit - offset = Thread.current[:loop_count] * thread_step + thread_offset_base + start_offset_base + offset = (Thread.current[:loop_count] * thread_step) + thread_offset_base + start_offset_base break if !imported?( remote_object: remote_object, diff --git a/lib/sequencer/unit/import/common/object_attribute/sanitized_name.rb b/lib/sequencer/unit/import/common/object_attribute/sanitized_name.rb index 557cd382d..902f14965 100644 --- a/lib/sequencer/unit/import/common/object_attribute/sanitized_name.rb +++ b/lib/sequencer/unit/import/common/object_attribute/sanitized_name.rb @@ -74,9 +74,7 @@ class Sequencer # Model Name # Model::Name # Model Name? - # rubocop:disable Style/AsciiComments # Mödel Nâmé - # rubocop:enable Style/AsciiComments raise 'Missing implementation for unsanitized_name method' end end diff --git a/lib/stats/ticket_waiting_time.rb b/lib/stats/ticket_waiting_time.rb index 530a59599..4575f4613 100644 --- a/lib/stats/ticket_waiting_time.rb +++ b/lib/stats/ticket_waiting_time.rb @@ -33,7 +33,7 @@ class Stats::TicketWaitingTime percent = (handling_time.to_f - 60) / (60 * 3) 'good' elsif handling_time <= 60 * 8 - percent = (handling_time.to_f - 60 * 4) / (60 * 4) + percent = (handling_time.to_f - (60 * 4)) / (60 * 4) 'ok' else percent = 1.00 diff --git a/lib/twitter_sync.rb b/lib/twitter_sync.rb index af244457b..0b14e58b2 100644 --- a/lib/twitter_sync.rb +++ b/lib/twitter_sync.rb @@ -501,11 +501,9 @@ create a tweet or direct message from an article Rails.logger.debug { 'Create tweet from article...' } - # rubocop:disable Style/AsciiComments # workaround for https://github.com/sferik/twitter/issues/677 # https://github.com/zammad/zammad/issues/2873 - unable to post # tweets with * - replace `*` with the wide-asterisk `*`. - # rubocop:enable Style/AsciiComments article[:body].tr!('*', '*') if article[:body].present? tweet = @client.update( article[:body], diff --git a/spec/models/ticket_spec.rb b/spec/models/ticket_spec.rb index 22d5736d3..e1a652edd 100644 --- a/spec/models/ticket_spec.rb +++ b/spec/models/ticket_spec.rb @@ -2183,7 +2183,7 @@ RSpec.describe Ticket, type: :model do Store.add( object: 'SomeObject', o_id: 1, - data: 'a' * (1024**2 * 2.4), # with 2.4 mb + data: 'a' * ((1024**2) * 2.4), # with 2.4 mb filename: 'test.TXT', created_by_id: 1, ) @@ -2258,7 +2258,7 @@ RSpec.describe Ticket, type: :model do Store.add( object: 'Ticket::Article', o_id: article1.id, - data: 'a' * (1024**2 * 2.4), # with 2.4 mb + data: 'a' * ((1024**2) * 2.4), # with 2.4 mb filename: 'some_file.pdf', preferences: { 'Content-Type' => 'image/pdf', @@ -2268,14 +2268,14 @@ RSpec.describe Ticket, type: :model do Store.add( object: 'Ticket::Article', o_id: article1.id, - data: 'a' * (1024**2 * 5.8), # with 5,8 mb + data: 'a' * ((1024**2) * 5.8), # with 5,8 mb filename: 'some_file.txt', preferences: { 'Content-Type' => 'text/plain', }, created_by_id: 1, ) - create(:ticket_article, ticket: ticket, body: 'a' * (1024**2 * 1.2)) # body with 1,2 mb + create(:ticket_article, ticket: ticket, body: 'a' * ((1024**2) * 1.2)) # body with 1,2 mb create(:ticket_article, ticket: ticket) ticket.search_index_attribute_lookup end