From 25d36b6edd77ed161b2f496101f7127f7c1c9e5c Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Wed, 15 Mar 2023 21:34:00 -0400 Subject: [PATCH] Autofix Rubocop Style/RedundantArgument (#23798) --- .rubocop_todo.yml | 9 --------- app/controllers/concerns/signature_verification.rb | 2 +- app/helpers/application_helper.rb | 4 ++-- lib/tasks/emojis.rake | 4 ++-- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0921d4f731..6dbcbaeba1 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -2050,15 +2050,6 @@ Style/OptionalBooleanParameter: - 'app/workers/unfollow_follow_worker.rb' - 'lib/mastodon/redis_config.rb' -# Offense count: 5 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: Methods. -Style/RedundantArgument: - Exclude: - - 'app/controllers/concerns/signature_verification.rb' - - 'app/helpers/application_helper.rb' - - 'lib/tasks/emojis.rake' - # Offense count: 16 # This cop supports safe autocorrection (--autocorrect). Style/RedundantRegexpCharacterClass: diff --git a/app/controllers/concerns/signature_verification.rb b/app/controllers/concerns/signature_verification.rb index b0a087d536..9317259433 100644 --- a/app/controllers/concerns/signature_verification.rb +++ b/app/controllers/concerns/signature_verification.rb @@ -138,7 +138,7 @@ module SignatureVerification end def signed_headers - signature_params.fetch('headers', signature_algorithm == 'hs2019' ? '(created)' : 'date').downcase.split(' ') + signature_params.fetch('headers', signature_algorithm == 'hs2019' ? '(created)' : 'date').downcase.split end def verify_signature_strength! diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 08020a65a2..9dc8bba2d7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -112,7 +112,7 @@ module ApplicationHelper def fa_icon(icon, attributes = {}) class_names = attributes[:class]&.split(' ') || [] class_names << 'fa' - class_names += icon.split(' ').map { |cl| "fa-#{cl}" } + class_names += icon.split.map { |cl| "fa-#{cl}" } content_tag(:i, nil, attributes.merge(class: class_names.join(' '))) end @@ -164,7 +164,7 @@ module ApplicationHelper end def body_classes - output = (@body_classes || '').split(' ') + output = (@body_classes || '').split output << "theme-#{current_theme.parameterize}" output << 'system-font' if current_account&.user&.setting_system_font_ui output << (current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion') diff --git a/lib/tasks/emojis.rake b/lib/tasks/emojis.rake index c743f8a554..fbb2e8d4f3 100644 --- a/lib/tasks/emojis.rake +++ b/lib/tasks/emojis.rake @@ -6,7 +6,7 @@ def gen_border(codepoint, color) doc = File.open(input) { |f| Nokogiri::XML(f) } svg = doc.at_css('svg') if svg.key?('viewBox') - view_box = svg['viewBox'].split(' ').map(&:to_i) + view_box = svg['viewBox'].split.map(&:to_i) view_box[0] -= 2 view_box[1] -= 2 view_box[2] += 4 @@ -36,7 +36,7 @@ end def codepoints_to_unicode(codepoints) if codepoints.include?(' ') - codepoints.split(' ').map(&:hex).pack('U*') + codepoints.split.map(&:hex).pack('U*') else [codepoints.hex].pack('U') end