Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Autofix Rubocop Style/HashSyntax (mastodon#23754)
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni authored May 4, 2023
1 parent d5a185d commit da3bd91
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 22 deletions.
13 changes: 0 additions & 13 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def custom_emoji_tag(custom_emoji)
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

Expand Down
6 changes: 3 additions & 3 deletions app/models/media_attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion lib/terrapin/multi_pipe_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize

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
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/admin/reports/actions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/admin/statuses_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

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] }
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/concerns/signature_verification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def signature_required

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

Expand Down

0 comments on commit da3bd91

Please sign in to comment.