Autofix Rubocop Lint/SymbolConversion (#23683)

lolsob-rspec
Nick Schonning 2023-02-17 21:23:49 -05:00 committed by GitHub
parent efcf9f0076
commit a71a0802d6
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/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
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.

View File

@ -29,7 +29,7 @@ class TranslationService::DeepL < TranslationService
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.add_headers('Authorization': "DeepL-Auth-Key #{@api_key}")
req.add_headers(Authorization: "DeepL-Auth-Key #{@api_key}")
req
end

View File

@ -23,7 +23,7 @@ class BackupService < BaseService
account.statuses.with_includes.reorder(nil).find_in_batches do |statuses|
statuses.each do |status|
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?
item[:object][:attachment].each do |attachment|

View File

@ -178,7 +178,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
Setting.registrations_mode = 'approved'
request.headers["Accept-Language"] = accept_language
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
it 'redirects to setup' do
@ -210,7 +210,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
Setting.require_invite_text = true
request.headers["Accept-Language"] = accept_language
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
it 'redirects to setup' do

View File

@ -127,7 +127,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
before do
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)
post :create, params: { user: { email: user.email, password: user.password } }
end

View File

@ -82,9 +82,9 @@ RSpec.describe ActivityPub::Activity::Announce do
content: 'Lorem ipsum',
attributedTo: 'https://example.com/actor',
to: {
'type': 'OrderedCollection',
'id': 'http://example.com/followers',
'first': 'http://example.com/followers?page=true',
type: 'OrderedCollection',
id: 'http://example.com/followers',
first: 'http://example.com/followers?page=true',
}
}
end

View File

@ -252,9 +252,9 @@ RSpec.describe ActivityPub::Activity::Create do
type: 'Note',
content: 'Lorem ipsum',
to: {
'type': 'OrderedCollection',
'id': 'http://example.com/followers',
'first': 'http://example.com/followers?page=true',
type: 'OrderedCollection',
id: 'http://example.com/followers',
first: 'http://example.com/followers?page=true',
}
}
end

View File

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