Autofix Rubocop Lint/SymbolConversion (#23683)

This commit is contained in:
Nick Schonning 2023-02-17 21:23:49 -05:00 committed by GitHub
parent 6d42820e5d
commit 634368c491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 49 deletions

View File

@ -298,20 +298,6 @@ Lint/ParenthesesAsGroupedExpression:
- 'spec/lib/activitypub/activity/flag_spec.rb' - 'spec/lib/activitypub/activity/flag_spec.rb'
- 'spec/models/import_spec.rb' - 'spec/models/import_spec.rb'
# Offense count: 35
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, consistent
Lint/SymbolConversion:
Exclude:
- 'app/lib/translation_service/deepl.rb'
- 'app/services/backup_service.rb'
- 'spec/controllers/auth/registrations_controller_spec.rb'
- 'spec/controllers/auth/sessions_controller_spec.rb'
- 'spec/lib/activitypub/activity/announce_spec.rb'
- 'spec/lib/activitypub/activity/create_spec.rb'
- 'spec/services/activitypub/process_collection_service_spec.rb'
# Offense count: 3 # Offense count: 3
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.

View File

@ -29,7 +29,7 @@ class TranslationService::DeepL < TranslationService
def request(text, source_language, target_language) def request(text, source_language, target_language)
req = Request.new(:post, endpoint_url, form: { text: text, source_lang: source_language&.upcase, target_lang: target_language, tag_handling: 'html' }) req = Request.new(:post, endpoint_url, form: { text: text, source_lang: source_language&.upcase, target_lang: target_language, tag_handling: 'html' })
req.add_headers('Authorization': "DeepL-Auth-Key #{@api_key}") req.add_headers(Authorization: "DeepL-Auth-Key #{@api_key}")
req req
end end

View File

@ -23,7 +23,7 @@ class BackupService < BaseService
account.statuses.with_includes.reorder(nil).find_in_batches do |statuses| account.statuses.with_includes.reorder(nil).find_in_batches do |statuses|
statuses.each do |status| statuses.each do |status|
item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status), ActivityPub::ActivitySerializer, signer: @account) item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status), ActivityPub::ActivitySerializer, signer: @account)
item.delete(:'@context') item.delete(:@context)
unless item[:type] == 'Announce' || item[:object][:attachment].blank? unless item[:type] == 'Announce' || item[:object][:attachment].blank?
item[:object][:attachment].each do |attachment| item[:object][:attachment].each do |attachment|

View File

@ -178,7 +178,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
Setting.registrations_mode = 'approved' Setting.registrations_mode = 'approved'
request.headers["Accept-Language"] = accept_language request.headers["Accept-Language"] = accept_language
invite = Fabricate(:invite, max_uses: nil, expires_at: 1.hour.ago) invite = Fabricate(:invite, max_uses: nil, expires_at: 1.hour.ago)
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', 'invite_code': invite.code, agreement: 'true' } } post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
end end
it 'redirects to setup' do it 'redirects to setup' do
@ -210,7 +210,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
Setting.require_invite_text = true Setting.require_invite_text = true
request.headers["Accept-Language"] = accept_language request.headers["Accept-Language"] = accept_language
invite = Fabricate(:invite, user: inviter, max_uses: nil, expires_at: 1.hour.from_now) invite = Fabricate(:invite, user: inviter, max_uses: nil, expires_at: 1.hour.from_now)
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', 'invite_code': invite.code, agreement: 'true' } } post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
end end
it 'redirects to setup' do it 'redirects to setup' do

View File

@ -127,7 +127,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
before do before do
allow_any_instance_of(ActionDispatch::Request).to receive(:remote_ip).and_return(current_ip) allow_any_instance_of(ActionDispatch::Request).to receive(:remote_ip).and_return(current_ip)
allow(UserMailer).to receive(:suspicious_sign_in).and_return(double('email', 'deliver_later!': nil)) allow(UserMailer).to receive(:suspicious_sign_in).and_return(double('email', deliver_later!: nil))
user.update(current_sign_in_at: 1.month.ago) user.update(current_sign_in_at: 1.month.ago)
post :create, params: { user: { email: user.email, password: user.password } } post :create, params: { user: { email: user.email, password: user.password } }
end end

View File

@ -82,9 +82,9 @@ RSpec.describe ActivityPub::Activity::Announce do
content: 'Lorem ipsum', content: 'Lorem ipsum',
attributedTo: 'https://example.com/actor', attributedTo: 'https://example.com/actor',
to: { to: {
'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

@ -252,9 +252,9 @@ RSpec.describe ActivityPub::Activity::Create do
type: 'Note', type: 'Note',
content: 'Lorem ipsum', content: 'Lorem ipsum',
to: { to: {
'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

@ -107,23 +107,23 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
'@context': [ '@context': [
'https://www.w3.org/ns/activitystreams', 'https://www.w3.org/ns/activitystreams',
nil, nil,
{ 'object': 'https://www.w3.org/ns/activitystreams#object' } { object: 'https://www.w3.org/ns/activitystreams#object' }
], ],
'id': 'https://example.com/users/bob/fake-status/activity', id: 'https://example.com/users/bob/fake-status/activity',
'type': 'Create', type: 'Create',
'actor': 'https://example.com/users/bob', actor: 'https://example.com/users/bob',
'published': '2022-01-22T15:00:00Z', published: '2022-01-22T15:00:00Z',
'to': [ to: [
'https://www.w3.org/ns/activitystreams#Public' 'https://www.w3.org/ns/activitystreams#Public'
], ],
'cc': [ cc: [
'https://example.com/users/bob/followers' 'https://example.com/users/bob/followers'
], ],
'signature': { signature: {
'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',
@ -133,22 +133,22 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
'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',
'type': 'Note', type: 'Note',
'published': '2022-01-22T15:00:00Z', published: '2022-01-22T15:00:00Z',
'url': 'https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=puck-was-here', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=puck-was-here',
'attributedTo': 'https://example.com/users/bob', attributedTo: 'https://example.com/users/bob',
'to': [ to: [
'https://www.w3.org/ns/activitystreams#Public' 'https://www.w3.org/ns/activitystreams#Public'
], ],
'cc': [ cc: [
'https://example.com/users/bob/followers' 'https://example.com/users/bob/followers'
], ],
'sensitive': false, sensitive: false,
'atomUri': 'https://example.com/users/bob/fake-status', atomUri: 'https://example.com/users/bob/fake-status',
'conversation': 'tag:example.com,2022-03-09:objectId=15:objectType=Conversation', conversation: 'tag:example.com,2022-03-09:objectId=15:objectType=Conversation',
'content': '<p>puck was here</p>', content: '<p>puck was here</p>',
'@id': 'https://example.com/users/bob/statuses/107928807471117876', '@id': 'https://example.com/users/bob/statuses/107928807471117876',
'@type': 'https://www.w3.org/ns/activitystreams#Note', '@type': 'https://www.w3.org/ns/activitystreams#Note',