From 205c717f4d79fd028a0bc36dcc7531989bc54556 Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Fri, 28 May 2021 13:25:36 +0200 Subject: [PATCH] Maintenance: Updated rubocop(-* gems) to latest version (1.15.0). --- .rubocop/default.yml | 10 ++++++++++ Gemfile.lock | 20 +++++++++---------- app/models/ticket/number/base.rb | 2 +- .../common/object_attribute/sanitized_name.rb | 2 +- ...ble_domain_links_in_trigger_emails_spec.rb | 6 ++++-- .../inserting_knowledge_base_answer_spec.rb | 2 +- test/browser_test_helper.rb | 4 ++-- 7 files changed, 29 insertions(+), 17 deletions(-) diff --git a/.rubocop/default.yml b/.rubocop/default.yml index a6252d172..c130b0916 100644 --- a/.rubocop/default.yml +++ b/.rubocop/default.yml @@ -274,8 +274,18 @@ Style/StringConcatenation: - "config/routes/**/*" Style/RegexpLiteral: + Description: 'This cop enforces using // or %r around regular expressions.' EnforcedStyle: percent_r +Style/RedundantBegin: + Description: 'This cop checks for redundant `begin` blocks.' + Enabled: false + +Rails/EnvironmentVariableAccess: + Description: 'This cop looks for direct access to environment variables through the ENV variable within the application code.' + Enabled: true + AllowReads: true + # RSpec tests Style/NumericPredicate: Description: >- diff --git a/Gemfile.lock b/Gemfile.lock index 4da5cba1b..896464c7f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -362,7 +362,7 @@ GEM omniauth-oauth2 (>= 1.4.0) openssl (2.1.2) parallel (1.20.1) - parser (3.0.0.0) + parser (3.0.1.1) ast (~> 2.4.1) pg (0.21.0) pluginator (1.5.0) @@ -456,25 +456,25 @@ GEM rspec-support (~> 3.9.0) rspec-support (3.9.3) rszr (0.5.2) - rubocop (1.11.0) + rubocop (1.15.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.2.0, < 2.0) + rubocop-ast (>= 1.5.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.4.1) - parser (>= 2.7.1.5) - rubocop-performance (1.10.0) - rubocop (>= 0.90.0, < 2.0) + rubocop-ast (1.6.0) + parser (>= 3.0.1.1) + rubocop-performance (1.11.3) + rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.9.1) + rubocop-rails (2.10.1) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.90.0, < 2.0) - rubocop-rspec (2.2.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-rspec (2.3.0) rubocop (~> 1.0) rubocop-ast (>= 1.1.0) ruby-progressbar (1.11.0) diff --git a/app/models/ticket/number/base.rb b/app/models/ticket/number/base.rb index b94301808..1d5dc7b76 100644 --- a/app/models/ticket/number/base.rb +++ b/app/models/ticket/number/base.rb @@ -16,7 +16,7 @@ module Ticket::Number::Base chksum = 0 mult = 1 - number.to_s.split('').map(&:to_i).each do |digit| + number.to_s.chars.map(&:to_i).each do |digit| chksum += digit * mult mult = (mult % 3) + 1 end 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 ab7502a75..1f79e7d43 100644 --- a/lib/sequencer/unit/import/common/object_attribute/sanitized_name.rb +++ b/lib/sequencer/unit/import/common/object_attribute/sanitized_name.rb @@ -40,7 +40,7 @@ class Sequencer # model__name # model_name_ # model_name - downcased.split('').map { |char| char.match?(%r{[a-z0-9_]}) ? char : '_' }.join + downcased.chars.map { |char| char.match?(%r{[a-z0-9_]}) ? char : '_' }.join end def downcased diff --git a/spec/db/migrate/issue_2019_fix_double_domain_links_in_trigger_emails_spec.rb b/spec/db/migrate/issue_2019_fix_double_domain_links_in_trigger_emails_spec.rb index 9aa9bc8c1..f3fad3738 100644 --- a/spec/db/migrate/issue_2019_fix_double_domain_links_in_trigger_emails_spec.rb +++ b/spec/db/migrate/issue_2019_fix_double_domain_links_in_trigger_emails_spec.rb @@ -3,17 +3,19 @@ require 'rails_helper' RSpec.describe Issue2019FixDoubleDomainLinksInTriggerEmails, type: :db_migration do subject { create(:trigger, perform: { 'notification.email' => { 'body' => faulty_link, 'recipient' => 'customer', 'subject' => 'some subject' } }) } + # rubocop:disable Lint/InterpolationCheck let(:faulty_link) do '' \ - 'View ticket' \ + 'View ticket' \ '' end let(:fixed_link) do '' \ - 'View ticket' \ + 'View ticket' \ '' end + # rubocop:enable Lint/InterpolationCheck it "removes duplicate domains from Trigger records' notification.email bodies" do expect { migrate }.to change { subject.reload.perform['notification.email']['body'] } diff --git a/spec/system/ticket/inserting_knowledge_base_answer_spec.rb b/spec/system/ticket/inserting_knowledge_base_answer_spec.rb index 38975b3fb..4a212609c 100644 --- a/spec/system/ticket/inserting_knowledge_base_answer_spec.rb +++ b/spec/system/ticket/inserting_knowledge_base_answer_spec.rb @@ -61,7 +61,7 @@ RSpec.describe 'inserting Knowledge Base answer', type: :system, authenticated_a def insert_kb_answer(translation, target_field) target_field.send_keys('??') - translation.title.slice(0, 3).split('').each { |letter| target_field.send_keys(letter) } + translation.title.slice(0, 3).chars.each { |letter| target_field.send_keys(letter) } find(:text_module, translation.id).click end diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 8a848e91f..6795eb87a 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -786,7 +786,7 @@ class TestCase < ActiveSupport::TestCase begin if params[:slow] element.send_keys('') - keys = params[:value].to_s.split('') + keys = params[:value].to_s.chars keys.each do |key| instance.action.send_keys(key).perform end @@ -803,7 +803,7 @@ class TestCase < ActiveSupport::TestCase if params[:slow] element.send_keys('') - keys = params[:value].to_s.split('') + keys = params[:value].to_s.chars keys.each do |key| instance.action.send_keys(key).perform end