M .rubocop_todo.yml => .rubocop_todo.yml +0 -10
@@ 1203,16 1203,6 @@ Rails/BulkChangeTable:
- 'db/migrate/20220303000827_add_ordered_media_attachment_ids_to_status_edits.rb'
- 'db/migrate/20220824164433_add_human_identifier_to_admin_action_logs.rb'
-# This cop supports unsafe autocorrection (--autocorrect-all).
-Rails/CompactBlank:
- Exclude:
- - 'app/helpers/application_helper.rb'
- - 'app/helpers/statuses_helper.rb'
- - 'app/models/concerns/attachmentable.rb'
- - 'app/models/poll.rb'
- - 'app/services/import_service.rb'
- - 'config/initializers/paperclip.rb'
-
# Configuration parameters: Include.
# Include: db/migrate/*.rb
Rails/CreateTableWithTimestamps:
M app/helpers/application_helper.rb => app/helpers/application_helper.rb +1 -1
@@ 161,7 161,7 @@ module ApplicationHelper
output << 'system-font' if current_account&.user&.setting_system_font_ui
output << (current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion')
output << 'rtl' if locale_direction == 'rtl'
- output.reject(&:blank?).join(' ')
+ output.compact_blank.join(' ')
end
def cdn_host
M app/helpers/statuses_helper.rb => app/helpers/statuses_helper.rb +2 -2
@@ 51,14 51,14 @@ module StatusesHelper
end
def status_description(status)
- components = [[media_summary(status), status_text_summary(status)].reject(&:blank?).join(' · ')]
+ components = [[media_summary(status), status_text_summary(status)].compact_blank.join(' · ')]
if status.spoiler_text.blank?
components << status.text
components << poll_summary(status)
end
- components.reject(&:blank?).join("\n\n")
+ components.compact_blank.join("\n\n")
end
def stream_link_target
M app/models/concerns/attachmentable.rb => app/models/concerns/attachmentable.rb +1 -1
@@ 46,7 46,7 @@ module Attachmentable
def set_file_extension(attachment) # rubocop:disable Naming/AccessorMethodName
return if attachment.blank?
- attachment.instance_write :file_name, [Paperclip::Interpolations.basename(attachment, :original), appropriate_extension(attachment)].delete_if(&:blank?).join('.')
+ attachment.instance_write :file_name, [Paperclip::Interpolations.basename(attachment, :original), appropriate_extension(attachment)].compact_blank!.join('.')
end
def check_image_dimension(attachment)
M app/models/poll.rb => app/models/poll.rb +1 -1
@@ 101,7 101,7 @@ class Poll < ApplicationRecord
end
def prepare_options
- self.options = options.map(&:strip).reject(&:blank?)
+ self.options = options.map(&:strip).compact_blank
end
def reset_parent_cache
M app/models/user.rb => app/models/user.rb +0 -1
@@ 445,7 445,6 @@ class User < ApplicationRecord
return if chosen_languages.nil?
chosen_languages.compact_blank!
-
self.chosen_languages = nil if chosen_languages.empty?
end
M app/services/import_service.rb => app/services/import_service.rb +1 -1
@@ 132,7 132,7 @@ class ImportService < BaseService
def parse_import_data!(default_headers)
data = CSV.parse(import_data, headers: true)
data = CSV.parse(import_data, headers: default_headers) unless data.headers&.first&.strip&.include?(' ')
- @data = data.reject(&:blank?)
+ @data = data.compact_blank
end
def import_data
M config/initializers/paperclip.rb => config/initializers/paperclip.rb +1 -1
@@ 7,7 7,7 @@ Paperclip.interpolates :filename do |attachment, style|
if style == :original
attachment.original_filename
else
- [basename(attachment, style), extension(attachment, style)].delete_if(&:blank?).join('.')
+ [basename(attachment, style), extension(attachment, style)].compact_blank!.join('.')
end
end