From 41243c84a102562338c18e089b915212a3024cb9 Mon Sep 17 00:00:00 2001 From: MarttiCheng Date: Tue, 12 May 2020 19:43:38 +0900 Subject: [PATCH] Change the max line length of `Layout/LineLength` to 120 Follow up https://github.com/rubocop-hq/rubocop/pull/7952. --- lib/rubocop/cop/performance/redundant_merge.rb | 4 +--- lib/rubocop/cop/performance/string_replacement.rb | 12 +++--------- spec/project_spec.rb | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/rubocop/cop/performance/redundant_merge.rb b/lib/rubocop/cop/performance/redundant_merge.rb index f5de5b4..bfb7347 100644 --- a/lib/rubocop/cop/performance/redundant_merge.rb +++ b/lib/rubocop/cop/performance/redundant_merge.rb @@ -182,9 +182,7 @@ def second_argument end def unwind(receiver) - while receiver.respond_to?(:send_type?) && receiver.send_type? - receiver, = *receiver - end + receiver, = *receiver while receiver.respond_to?(:send_type?) && receiver.send_type? receiver end diff --git a/lib/rubocop/cop/performance/string_replacement.rb b/lib/rubocop/cop/performance/string_replacement.rb index 214daf6..072830d 100644 --- a/lib/rubocop/cop/performance/string_replacement.rb +++ b/lib/rubocop/cop/performance/string_replacement.rb @@ -48,9 +48,7 @@ def autocorrect(node) first_source, = first_source(first_param) second_source, = *second_param - unless first_param.str_type? - first_source = interpret_string_escapes(first_source) - end + first_source = interpret_string_escapes(first_source) unless first_param.str_type? replacement_method = replacement_method(node, first_source, second_source) @@ -67,9 +65,7 @@ def replace_method(node, first, second, first_param, replacement) to_string_literal(first)) end - if second.empty? && first.length == 1 - remove_second_param(corrector, node, first_param) - end + remove_second_param(corrector, node, first_param) if second.empty? && first.length == 1 end end @@ -99,9 +95,7 @@ def accept_first_param?(first_param) def offense(node, first_param, second_param) first_source, = first_source(first_param) - unless first_param.str_type? - first_source = interpret_string_escapes(first_source) - end + first_source = interpret_string_escapes(first_source) unless first_param.str_type? second_source, = *second_param message = message(node, first_source, second_source) diff --git a/spec/project_spec.rb b/spec/project_spec.rb index 23d49d8..7053817 100644 --- a/spec/project_spec.rb +++ b/spec/project_spec.rb @@ -140,7 +140,7 @@ it 'has a valid URL' do issues.each do |issue| number = issue[:number].gsub(/\D/, '') - pattern = %r{^https://github\.com/rubocop-hq/rubocop-performance/(?:issues|pull)/#{number}$} # rubocop:disable Layout/LineLength + pattern = %r{^https://github\.com/rubocop-hq/rubocop-performance/(?:issues|pull)/#{number}$} expect(issue[:url]).to match(pattern) end end