From 2f2c8f671b19c7a5d1d4b86b4b89bfb1d429d7e3 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Wed, 3 May 2023 23:54:26 -0400 Subject: [PATCH] Autofix Rubocop Style/HashSyntax (#23754) --- .rubocop_todo.yml | 13 ------------- app/helpers/application_helper.rb | 2 +- app/models/media_attachment.rb | 6 +++--- lib/terrapin/multi_pipe_extensions.rb | 2 +- .../admin/reports/actions_controller_spec.rb | 2 +- spec/controllers/admin/statuses_controller_spec.rb | 2 +- .../concerns/signature_verification_spec.rb | 4 ++-- 7 files changed, 9 insertions(+), 22 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d1850aa2b5..bc6c86ed2a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1549,19 +1549,6 @@ Style/HashAsLastArrayItem: - 'app/services/notify_service.rb' - 'db/migrate/20181024224956_migrate_account_conversations.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. -# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys -# SupportedShorthandSyntax: always, never, either, consistent -Style/HashSyntax: - Exclude: - - 'app/helpers/application_helper.rb' - - 'app/models/media_attachment.rb' - - 'lib/terrapin/multi_pipe_extensions.rb' - - 'spec/controllers/admin/reports/actions_controller_spec.rb' - - 'spec/controllers/admin/statuses_controller_spec.rb' - - 'spec/controllers/concerns/signature_verification_spec.rb' - # This cop supports unsafe autocorrection (--autocorrect-all). Style/HashTransformValues: Exclude: diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c50389a938..19d297725e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -143,7 +143,7 @@ module ApplicationHelper if prefers_autoplay? image_tag(custom_emoji.image.url, class: 'emojione', alt: ":#{custom_emoji.shortcode}:") else - image_tag(custom_emoji.image.url(:static), class: 'emojione custom-emoji', alt: ":#{custom_emoji.shortcode}", 'data-original' => full_asset_url(custom_emoji.image.url), 'data-static' => full_asset_url(custom_emoji.image.url(:static))) + image_tag(custom_emoji.image.url(:static), :class => 'emojione custom-emoji', :alt => ":#{custom_emoji.shortcode}", 'data-original' => full_asset_url(custom_emoji.image.url), 'data-static' => full_asset_url(custom_emoji.image.url(:static))) end end diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 9a465e5dd5..8689a956e9 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -34,8 +34,8 @@ class MediaAttachment < ApplicationRecord include Attachmentable - enum type: { :image => 0, :gifv => 1, :video => 2, :unknown => 3, :audio => 4 } - enum processing: { :queued => 0, :in_progress => 1, :complete => 2, :failed => 3 }, _prefix: true + enum type: { image: 0, gifv: 1, video: 2, unknown: 3, audio: 4 } + enum processing: { queued: 0, in_progress: 1, complete: 2, failed: 3 }, _prefix: true MAX_DESCRIPTION_LENGTH = 1_500 @@ -135,7 +135,7 @@ class MediaAttachment < ApplicationRecord convert_options: { output: { 'loglevel' => 'fatal', - vf: 'scale=\'min(400\, iw):min(400\, ih)\':force_original_aspect_ratio=decrease', + :vf => 'scale=\'min(400\, iw):min(400\, ih)\':force_original_aspect_ratio=decrease', }.freeze, }.freeze, format: 'png', diff --git a/lib/terrapin/multi_pipe_extensions.rb b/lib/terrapin/multi_pipe_extensions.rb index 209f4ad6ce..bddba4a2b1 100644 --- a/lib/terrapin/multi_pipe_extensions.rb +++ b/lib/terrapin/multi_pipe_extensions.rb @@ -13,7 +13,7 @@ module Terrapin def pipe_options # Add some flags to explicitly close the other end of the pipes - { out: @stdout_out, err: @stderr_out, @stdout_in => :close, @stderr_in => :close } + { :out => @stdout_out, :err => @stderr_out, @stdout_in => :close, @stderr_in => :close } end def read diff --git a/spec/controllers/admin/reports/actions_controller_spec.rb b/spec/controllers/admin/reports/actions_controller_spec.rb index e9a8f74c0a..a84f2324e1 100644 --- a/spec/controllers/admin/reports/actions_controller_spec.rb +++ b/spec/controllers/admin/reports/actions_controller_spec.rb @@ -15,7 +15,7 @@ describe Admin::Reports::ActionsController do let(:report) { Fabricate(:report) } before do - post :preview, params: { report_id: report.id, action => '' } + post :preview, params: { :report_id => report.id, action => '' } end context 'when the action is "suspend"' do diff --git a/spec/controllers/admin/statuses_controller_spec.rb b/spec/controllers/admin/statuses_controller_spec.rb index e4954b62c9..872aed9998 100644 --- a/spec/controllers/admin/statuses_controller_spec.rb +++ b/spec/controllers/admin/statuses_controller_spec.rb @@ -43,7 +43,7 @@ describe Admin::StatusesController do describe 'POST #batch' do before do - post :batch, params: { account_id: account.id, action => '', admin_status_batch_action: { status_ids: status_ids } } + post :batch, params: { :account_id => account.id, action => '', :admin_status_batch_action => { status_ids: status_ids } } end let(:status_ids) { [media_attached_status.id] } diff --git a/spec/controllers/concerns/signature_verification_spec.rb b/spec/controllers/concerns/signature_verification_spec.rb index 45d04aa61d..df20a5d7ef 100644 --- a/spec/controllers/concerns/signature_verification_spec.rb +++ b/spec/controllers/concerns/signature_verification_spec.rb @@ -35,8 +35,8 @@ describe ApplicationController do before do routes.draw do - match via: [:get, :post], 'success' => 'anonymous#success' - match via: [:get, :post], 'signature_required' => 'anonymous#signature_required' + match :via => [:get, :post], 'success' => 'anonymous#success' + match :via => [:get, :post], 'signature_required' => 'anonymous#signature_required' end end