Autofix Rubocop Style/TrailingCommaInHashLiteral (#23693)

pull/21972/head
Nick Schonning 2023-02-18 09:33:41 -05:00 committed by GitHub
parent de4b8224c0
commit 5069769cbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 61 additions and 89 deletions

View File

@ -3417,34 +3417,6 @@ Style/TrailingCommaInArrayLiteral:
- 'spec/services/activitypub/process_collection_service_spec.rb' - 'spec/services/activitypub/process_collection_service_spec.rb'
- 'spec/workers/activitypub/move_distribution_worker_spec.rb' - 'spec/workers/activitypub/move_distribution_worker_spec.rb'
# Offense count: 61
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInHashLiteral:
Exclude:
- 'spec/controllers/admin/accounts_controller_spec.rb'
- 'spec/controllers/admin/domain_blocks_controller_spec.rb'
- 'spec/controllers/api/v1/accounts/credentials_controller_spec.rb'
- 'spec/controllers/api/v1/push/subscriptions_controller_spec.rb'
- 'spec/controllers/api/web/push_subscriptions_controller_spec.rb'
- 'spec/controllers/settings/applications_controller_spec.rb'
- 'spec/controllers/settings/imports_controller_spec.rb'
- 'spec/controllers/settings/preferences/notifications_controller_spec.rb'
- 'spec/controllers/settings/preferences/other_controller_spec.rb'
- 'spec/lib/activitypub/activity/announce_spec.rb'
- 'spec/lib/activitypub/activity/create_spec.rb'
- 'spec/services/activitypub/fetch_featured_collection_service_spec.rb'
- 'spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb'
- 'spec/services/activitypub/fetch_remote_status_service_spec.rb'
- 'spec/services/activitypub/fetch_replies_service_spec.rb'
- 'spec/services/activitypub/process_account_service_spec.rb'
- 'spec/services/activitypub/process_collection_service_spec.rb'
- 'spec/services/activitypub/process_status_update_service_spec.rb'
- 'spec/services/activitypub/synchronize_followers_service_spec.rb'
- 'spec/services/fetch_resource_service_spec.rb'
- 'spec/spec_helper.rb'
# Offense count: 4 # Offense count: 4
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).
Style/UnpackFirst: Style/UnpackFirst:

View File

@ -39,7 +39,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
username: 'username', username: 'username',
display_name: 'display name', display_name: 'display name',
email: 'local-part@domain', email: 'local-part@domain',
ip: '0.0.0.42' ip: '0.0.0.42',
} }
end end

View File

@ -26,9 +26,9 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
domain_blocks_attributes: { domain_blocks_attributes: {
'0' => { enabled: '1', domain: 'example.com', severity: 'silence' }, '0' => { enabled: '1', domain: 'example.com', severity: 'silence' },
'1' => { enabled: '0', domain: 'mastodon.social', severity: 'suspend' }, '1' => { enabled: '0', domain: 'mastodon.social', severity: 'suspend' },
'2' => { enabled: '1', domain: 'mastodon.online', severity: 'suspend' } '2' => { enabled: '1', domain: 'mastodon.online', severity: 'suspend' },
} },
} },
} }
expect(DomainBlockWorker).to have_received(:perform_async).exactly(2).times expect(DomainBlockWorker).to have_received(:perform_async).exactly(2).times

View File

@ -35,7 +35,7 @@ describe Api::V1::Accounts::CredentialsController do
source: { source: {
privacy: 'unlisted', privacy: 'unlisted',
sensitive: true, sensitive: true,
} },
} }
end end

View File

@ -20,7 +20,7 @@ describe Api::V1::Push::SubscriptionsController do
p256dh: 'BEm_a0bdPDhf0SOsrnB2-ategf1hHoCnpXgQsFj5JCkcoMrMt2WHoPfEYOYPzOIs9mZE8ZUaD7VA5vouy0kEkr8=', p256dh: 'BEm_a0bdPDhf0SOsrnB2-ategf1hHoCnpXgQsFj5JCkcoMrMt2WHoPfEYOYPzOIs9mZE8ZUaD7VA5vouy0kEkr8=',
auth: 'eH_C8rq2raXqlcBVDa1gLg==', auth: 'eH_C8rq2raXqlcBVDa1gLg==',
}, },
} },
}.with_indifferent_access }.with_indifferent_access
end end
@ -37,8 +37,8 @@ describe Api::V1::Push::SubscriptionsController do
mention: false, mention: false,
poll: true, poll: true,
status: false, status: false,
} },
} },
}.with_indifferent_access }.with_indifferent_access
end end

View File

@ -15,7 +15,7 @@ describe Api::Web::PushSubscriptionsController do
p256dh: 'BEm_a0bdPDhf0SOsrnB2-ategf1hHoCnpXgQsFj5JCkcoMrMt2WHoPfEYOYPzOIs9mZE8ZUaD7VA5vouy0kEkr8=', p256dh: 'BEm_a0bdPDhf0SOsrnB2-ategf1hHoCnpXgQsFj5JCkcoMrMt2WHoPfEYOYPzOIs9mZE8ZUaD7VA5vouy0kEkr8=',
auth: 'eH_C8rq2raXqlcBVDa1gLg==', auth: 'eH_C8rq2raXqlcBVDa1gLg==',
}, },
} },
} }
end end
@ -32,8 +32,8 @@ describe Api::Web::PushSubscriptionsController do
mention: false, mention: false,
poll: true, poll: true,
status: false, status: false,
} },
} },
} }
end end

View File

@ -51,8 +51,8 @@ describe Settings::ApplicationsController do
name: 'My New App', name: 'My New App',
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
website: 'http://google.com', website: 'http://google.com',
scopes: 'read write follow' scopes: 'read write follow',
} },
} }
response response
end end
@ -73,8 +73,8 @@ describe Settings::ApplicationsController do
name: 'My New App', name: 'My New App',
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
website: 'http://google.com', website: 'http://google.com',
scopes: ['read', 'write', 'follow'] scopes: ['read', 'write', 'follow'],
} },
} }
response response
end end
@ -95,8 +95,8 @@ describe Settings::ApplicationsController do
name: '', name: '',
redirect_uri: '', redirect_uri: '',
website: '', website: '',
scopes: [] scopes: [],
} },
} }
end end
@ -114,14 +114,14 @@ describe Settings::ApplicationsController do
context 'success' do context 'success' do
let(:opts) { let(:opts) {
{ {
website: 'https://foo.bar/' website: 'https://foo.bar/',
} }
} }
def call_update def call_update
patch :update, params: { patch :update, params: {
id: app.id, id: app.id,
doorkeeper_application: opts doorkeeper_application: opts,
} }
response response
end end
@ -144,8 +144,8 @@ describe Settings::ApplicationsController do
name: '', name: '',
redirect_uri: '', redirect_uri: '',
website: '', website: '',
scopes: [] scopes: [],
} },
} }
end end

View File

@ -21,8 +21,8 @@ RSpec.describe Settings::ImportsController, type: :controller do
post :create, params: { post :create, params: {
import: { import: {
type: 'following', type: 'following',
data: fixture_file_upload('imports.txt') data: fixture_file_upload('imports.txt'),
} },
} }
expect(response).to redirect_to(settings_import_path) expect(response).to redirect_to(settings_import_path)
@ -34,8 +34,8 @@ RSpec.describe Settings::ImportsController, type: :controller do
post :create, params: { post :create, params: {
import: { import: {
type: 'blocking', type: 'blocking',
data: fixture_file_upload('imports.txt') data: fixture_file_upload('imports.txt'),
} },
} }
expect(response).to redirect_to(settings_import_path) expect(response).to redirect_to(settings_import_path)

View File

@ -25,7 +25,7 @@ describe Settings::Preferences::NotificationsController do
user: { user: {
notification_emails: { follow: '1' }, notification_emails: { follow: '1' },
interactions: { must_be_follower: '0' }, interactions: { must_be_follower: '0' },
} },
} }
expect(response).to redirect_to(settings_preferences_notifications_path) expect(response).to redirect_to(settings_preferences_notifications_path)

View File

@ -34,7 +34,7 @@ describe Settings::Preferences::OtherController do
user: { user: {
setting_boost_modal: '1', setting_boost_modal: '1',
setting_delete_modal: '0', setting_delete_modal: '0',
} },
} }
expect(response).to redirect_to(settings_preferences_other_path) expect(response).to redirect_to(settings_preferences_other_path)

View File

@ -85,7 +85,7 @@ RSpec.describe ActivityPub::Activity::Announce do
type: 'OrderedCollection', type: 'OrderedCollection',
id: 'http://example.com/followers', id: 'http://example.com/followers',
first: 'http://example.com/followers?page=true', first: 'http://example.com/followers?page=true',
} },
} }
end end

View File

@ -255,7 +255,7 @@ RSpec.describe ActivityPub::Activity::Create do
type: 'OrderedCollection', type: 'OrderedCollection',
id: 'http://example.com/followers', id: 'http://example.com/followers',
first: 'http://example.com/followers?page=true', first: 'http://example.com/followers?page=true',
} },
} }
end end
@ -686,7 +686,7 @@ RSpec.describe ActivityPub::Activity::Create do
replies: { replies: {
type: 'Collection', type: 'Collection',
totalItems: 3, totalItems: 3,
} },
}, },
], ],
} }
@ -716,7 +716,7 @@ RSpec.describe ActivityPub::Activity::Create do
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note', type: 'Note',
name: 'Yellow', name: 'Yellow',
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status) inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status),
} }
end end
@ -741,7 +741,7 @@ RSpec.describe ActivityPub::Activity::Create do
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note', type: 'Note',
name: 'Yellow', name: 'Yellow',
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status) inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status),
} }
end end

View File

@ -109,7 +109,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do
type: 'CollectionPage', type: 'CollectionPage',
partOf: actor.featured_collection_url, partOf: actor.featured_collection_url,
items: items, items: items,
} },
}.with_indifferent_access }.with_indifferent_access
end end

View File

@ -81,7 +81,7 @@ RSpec.describe ActivityPub::FetchFeaturedTagsCollectionService, type: :service d
type: 'CollectionPage', type: 'CollectionPage',
partOf: collection_url, partOf: collection_url,
items: items, items: items,
} },
}.with_indifferent_access }.with_indifferent_access
end end

View File

@ -115,7 +115,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
id: "https://foo.bar/@foo/1234", id: "https://foo.bar/@foo/1234",
type: 'Event', type: 'Event',
name: "Let's change the world", name: "Let's change the world",
attributedTo: ActivityPub::TagManager.instance.uri_for(sender) attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
} }
end end

View File

@ -90,7 +90,7 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do
type: 'CollectionPage', type: 'CollectionPage',
partOf: collection_uri, partOf: collection_uri,
items: items, items: items,
} },
}.with_indifferent_access }.with_indifferent_access
end end

View File

@ -175,7 +175,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
name: "@user#{i + 1}", name: "@user#{i + 1}",
} }
], ],
to: ['as:Public', "https://foo.test/users/#{i + 1}"] to: ['as:Public', "https://foo.test/users/#{i + 1}"],
}.with_indifferent_access }.with_indifferent_access
featured_json = { featured_json = {
'@context': ['https://www.w3.org/ns/activitystreams'], '@context': ['https://www.w3.org/ns/activitystreams'],

View File

@ -123,15 +123,15 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
type: 'RsaSignature2017', type: 'RsaSignature2017',
creator: 'https://example.com/users/bob#main-key', creator: 'https://example.com/users/bob#main-key',
created: '2022-03-09T21:57:25Z', created: '2022-03-09T21:57:25Z',
signatureValue: 'WculK0LelTQ0MvGwU9TPoq5pFzFfGYRDCJqjZ232/Udj4CHqDTGOSw5UTDLShqBOyycCkbZGrQwXG+dpyDpQLSe1UVPZ5TPQtc/9XtI57WlS2nMNpdvRuxGnnb2btPdesXZ7n3pCxo0zjaXrJMe0mqQh5QJO22mahb4bDwwmfTHgbD3nmkD+fBfGi+UV2qWwqr+jlV4L4JqNkh0gWljF5KTePLRRZCuWiQ/FAt7c67636cdIPf7fR+usjuZltTQyLZKEGuK8VUn2Gkfsx5qns7Vcjvlz1JqlAjyO8HPBbzTTHzUG2nUOIgC3PojCSWv6mNTmRGoLZzOscCAYQA6cKw==' signatureValue: 'WculK0LelTQ0MvGwU9TPoq5pFzFfGYRDCJqjZ232/Udj4CHqDTGOSw5UTDLShqBOyycCkbZGrQwXG+dpyDpQLSe1UVPZ5TPQtc/9XtI57WlS2nMNpdvRuxGnnb2btPdesXZ7n3pCxo0zjaXrJMe0mqQh5QJO22mahb4bDwwmfTHgbD3nmkD+fBfGi+UV2qWwqr+jlV4L4JqNkh0gWljF5KTePLRRZCuWiQ/FAt7c67636cdIPf7fR+usjuZltTQyLZKEGuK8VUn2Gkfsx5qns7Vcjvlz1JqlAjyO8HPBbzTTHzUG2nUOIgC3PojCSWv6mNTmRGoLZzOscCAYQA6cKw==',
}, },
'@id': 'https://example.com/users/bob/statuses/107928807471117876/activity', '@id': 'https://example.com/users/bob/statuses/107928807471117876/activity',
'@type': 'https://www.w3.org/ns/activitystreams#Create', '@type': 'https://www.w3.org/ns/activitystreams#Create',
'https://www.w3.org/ns/activitystreams#actor': { 'https://www.w3.org/ns/activitystreams#actor': {
'@id': 'https://example.com/users/bob' '@id': 'https://example.com/users/bob',
}, },
'https://www.w3.org/ns/activitystreams#cc': { 'https://www.w3.org/ns/activitystreams#cc': {
'@id': 'https://example.com/users/bob/followers' '@id': 'https://example.com/users/bob/followers',
}, },
object: { object: {
id: 'https://example.com/users/bob/fake-status', id: 'https://example.com/users/bob/fake-status',
@ -156,21 +156,21 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
'http://ostatus.org#conversation': 'tag:example.com,2022-03-09:objectId=15:objectType=Conversation', 'http://ostatus.org#conversation': 'tag:example.com,2022-03-09:objectId=15:objectType=Conversation',
'https://www.w3.org/ns/activitystreams#attachment': [], 'https://www.w3.org/ns/activitystreams#attachment': [],
'https://www.w3.org/ns/activitystreams#attributedTo': { 'https://www.w3.org/ns/activitystreams#attributedTo': {
'@id': 'https://example.com/users/bob' '@id': 'https://example.com/users/bob',
}, },
'https://www.w3.org/ns/activitystreams#cc': { 'https://www.w3.org/ns/activitystreams#cc': {
'@id': 'https://example.com/users/bob/followers' '@id': 'https://example.com/users/bob/followers',
}, },
'https://www.w3.org/ns/activitystreams#content': [ 'https://www.w3.org/ns/activitystreams#content': [
'<p>hello world</p>', '<p>hello world</p>',
{ {
'@value': '<p>hello world</p>', '@value': '<p>hello world</p>',
'@language': 'en' '@language': 'en',
} }
], ],
'https://www.w3.org/ns/activitystreams#published': { 'https://www.w3.org/ns/activitystreams#published': {
'@type': 'http://www.w3.org/2001/XMLSchema#dateTime', '@type': 'http://www.w3.org/2001/XMLSchema#dateTime',
'@value': '2022-03-09T21:55:07Z' '@value': '2022-03-09T21:55:07Z',
}, },
'https://www.w3.org/ns/activitystreams#replies': { 'https://www.w3.org/ns/activitystreams#replies': {
'@id': 'https://example.com/users/bob/statuses/107928807471117876/replies', '@id': 'https://example.com/users/bob/statuses/107928807471117876/replies',
@ -179,29 +179,29 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
'@type': 'https://www.w3.org/ns/activitystreams#CollectionPage', '@type': 'https://www.w3.org/ns/activitystreams#CollectionPage',
'https://www.w3.org/ns/activitystreams#items': [], 'https://www.w3.org/ns/activitystreams#items': [],
'https://www.w3.org/ns/activitystreams#next': { 'https://www.w3.org/ns/activitystreams#next': {
'@id': 'https://example.com/users/bob/statuses/107928807471117876/replies?only_other_accounts=true&page=true' '@id': 'https://example.com/users/bob/statuses/107928807471117876/replies?only_other_accounts=true&page=true',
}, },
'https://www.w3.org/ns/activitystreams#partOf': { 'https://www.w3.org/ns/activitystreams#partOf': {
'@id': 'https://example.com/users/bob/statuses/107928807471117876/replies' '@id': 'https://example.com/users/bob/statuses/107928807471117876/replies',
} },
} },
}, },
'https://www.w3.org/ns/activitystreams#sensitive': false, 'https://www.w3.org/ns/activitystreams#sensitive': false,
'https://www.w3.org/ns/activitystreams#tag': [], 'https://www.w3.org/ns/activitystreams#tag': [],
'https://www.w3.org/ns/activitystreams#to': { 'https://www.w3.org/ns/activitystreams#to': {
'@id': 'https://www.w3.org/ns/activitystreams#Public' '@id': 'https://www.w3.org/ns/activitystreams#Public',
}, },
'https://www.w3.org/ns/activitystreams#url': { 'https://www.w3.org/ns/activitystreams#url': {
'@id': 'https://example.com/@bob/107928807471117876' '@id': 'https://example.com/@bob/107928807471117876',
} },
}, },
'https://www.w3.org/ns/activitystreams#published': { 'https://www.w3.org/ns/activitystreams#published': {
'@type': 'http://www.w3.org/2001/XMLSchema#dateTime', '@type': 'http://www.w3.org/2001/XMLSchema#dateTime',
'@value': '2022-03-09T21:55:07Z' '@value': '2022-03-09T21:55:07Z',
}, },
'https://www.w3.org/ns/activitystreams#to': { 'https://www.w3.org/ns/activitystreams#to': {
'@id': 'https://www.w3.org/ns/activitystreams#Public' '@id': 'https://www.w3.org/ns/activitystreams#Public',
} },
} }
end end

View File

@ -115,7 +115,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
account: account, account: account,
multiple: false, multiple: false,
hide_totals: false, hide_totals: false,
expires_at: expiration expires_at: expiration,
}) })
end end
@ -166,7 +166,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
account: account, account: account,
multiple: false, multiple: false,
hide_totals: false, hide_totals: false,
expires_at: expiration expires_at: expiration,
}) })
end end
@ -342,7 +342,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
updated: '2021-09-08T22:39:25Z', updated: '2021-09-08T22:39:25Z',
attachment: [ attachment: [
{ type: 'Image', mediaType: 'image/png', url: 'https://example.com/foo.png' }, { type: 'Image', mediaType: 'image/png', url: 'https://example.com/foo.png' },
] ],
} }
end end
@ -374,7 +374,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
updated: '2021-09-08T22:39:25Z', updated: '2021-09-08T22:39:25Z',
attachment: [ attachment: [
{ type: 'Image', mediaType: 'image/png', url: 'https://example.com/foo.png', name: 'A picture' }, { type: 'Image', mediaType: 'image/png', url: 'https://example.com/foo.png', name: 'A picture' },
] ],
} }
end end

View File

@ -91,7 +91,7 @@ RSpec.describe ActivityPub::SynchronizeFollowersService, type: :service do
type: 'CollectionPage', type: 'CollectionPage',
partOf: collection_uri, partOf: collection_uri,
items: items, items: items,
} },
}.with_indifferent_access }.with_indifferent_access
end end

View File

@ -91,7 +91,7 @@ RSpec.describe FetchResourceService, type: :service do
end end
context 'when link header is present' do context 'when link header is present' do
let(:headers) { { 'Link' => '<http://example.com/foo>; rel="alternate"; type="application/activity+json"', } } let(:headers) { { 'Link' => '<http://example.com/foo>; rel="alternate"; type="application/activity+json"' } }
it { is_expected.to eq [1, { prefetched_body: json, id: true }] } it { is_expected.to eq [1, { prefetched_body: json, id: true }] }
end end

View File

@ -61,6 +61,6 @@ end
def expect_push_bulk_to_match(klass, matcher) def expect_push_bulk_to_match(klass, matcher)
expect(Sidekiq::Client).to receive(:push_bulk).with(hash_including({ expect(Sidekiq::Client).to receive(:push_bulk).with(hash_including({
"class" => klass, "class" => klass,
"args" => matcher "args" => matcher,
})) }))
end end