1
0
Fork 0
forked from fedi/mastodon

Autofix Rubocop Style/RedundantArgument (#23798)

This commit is contained in:
Nick Schonning 2023-03-15 21:34:00 -04:00 committed by GitHub
parent 0566c81a0c
commit 25d36b6edd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 14 deletions

View file

@ -2050,15 +2050,6 @@ Style/OptionalBooleanParameter:
- 'app/workers/unfollow_follow_worker.rb' - 'app/workers/unfollow_follow_worker.rb'
- 'lib/mastodon/redis_config.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 # Offense count: 16
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpCharacterClass: Style/RedundantRegexpCharacterClass:

View file

@ -138,7 +138,7 @@ module SignatureVerification
end end
def signed_headers 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 end
def verify_signature_strength! def verify_signature_strength!

View file

@ -112,7 +112,7 @@ module ApplicationHelper
def fa_icon(icon, attributes = {}) def fa_icon(icon, attributes = {})
class_names = attributes[:class]&.split(' ') || [] class_names = attributes[:class]&.split(' ') || []
class_names << 'fa' 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(' '))) content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
end end
@ -164,7 +164,7 @@ module ApplicationHelper
end end
def body_classes def body_classes
output = (@body_classes || '').split(' ') output = (@body_classes || '').split
output << "theme-#{current_theme.parameterize}" output << "theme-#{current_theme.parameterize}"
output << 'system-font' if current_account&.user&.setting_system_font_ui output << 'system-font' if current_account&.user&.setting_system_font_ui
output << (current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion') output << (current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion')

View file

@ -6,7 +6,7 @@ def gen_border(codepoint, color)
doc = File.open(input) { |f| Nokogiri::XML(f) } doc = File.open(input) { |f| Nokogiri::XML(f) }
svg = doc.at_css('svg') svg = doc.at_css('svg')
if svg.key?('viewBox') 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[0] -= 2
view_box[1] -= 2 view_box[1] -= 2
view_box[2] += 4 view_box[2] += 4
@ -36,7 +36,7 @@ end
def codepoints_to_unicode(codepoints) def codepoints_to_unicode(codepoints)
if codepoints.include?(' ') if codepoints.include?(' ')
codepoints.split(' ').map(&:hex).pack('U*') codepoints.split.map(&:hex).pack('U*')
else else
[codepoints.hex].pack('U') [codepoints.hex].pack('U')
end end