Skip to content

Commit

Permalink
Run rubocop formatting except line length (mastodon#23632)
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni authored and skerit committed Jul 7, 2023
1 parent 9b38ac1 commit aa020c5
Show file tree
Hide file tree
Showing 71 changed files with 269 additions and 566 deletions.
277 changes: 1 addition & 276 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit`
# on 2023-02-16 04:55:24 UTC using RuboCop version 1.45.1.
# on 2023-02-16 05:53:07 UTC using RuboCop version 1.45.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -14,53 +14,6 @@ Bundler/OrderedGems:
Exclude:
- 'Gemfile'

# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_argument, with_fixed_indentation
Layout/ArgumentAlignment:
Exclude:
- 'spec/models/account_statuses_cleanup_policy_spec.rb'
- 'spec/services/activitypub/process_collection_service_spec.rb'
- 'spec/services/activitypub/process_status_update_service_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleAlignWith.
# SupportedStylesAlignWith: either, start_of_block, start_of_line
Layout/BlockAlignment:
Exclude:
- 'spec/controllers/api/v1/accounts/credentials_controller_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Layout/ClosingParenthesisIndentation:
Exclude:
- 'spec/controllers/auth/sessions_controller_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment.
Layout/CommentIndentation:
Exclude:
- 'db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb'

# Offense count: 22
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: leading, trailing
Layout/DotPosition:
Exclude:
- 'lib/paperclip/attachment_extensions.rb'
- 'spec/routing/api_routing_spec.rb'
- 'spec/routing/well_known_routes_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Layout/ElseAlignment:
Exclude:
- 'db/migrate/20161006213403_rails_settings_migration.rb'

# Offense count: 81
# This cop supports safe autocorrection (--autocorrect).
Layout/EmptyLineAfterGuardClause:
Expand Down Expand Up @@ -183,73 +136,6 @@ Layout/EmptyLineAfterMagicComment:
- 'spec/controllers/api/v1/accounts/statuses_controller_spec.rb'
- 'spec/models/tag_spec.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
Layout/EmptyLines:
Exclude:
- 'spec/controllers/authorize_interactions_controller_spec.rb'
- 'spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb'
- 'spec/lib/activitypub/activity/create_spec.rb'

# Offense count: 9
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Exclude:
- 'spec/fabricators/system_key_fabricator.rb'
- 'spec/models/account_alias_spec.rb'
- 'spec/models/device_spec.rb'
- 'spec/models/encrypted_message_spec.rb'
- 'spec/models/login_activity_spec.rb'
- 'spec/models/one_time_key_spec.rb'
- 'spec/models/system_key_spec.rb'
- 'spec/services/bootstrap_timeline_service_spec.rb'
- 'spec/services/fetch_oembed_service_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleAlignWith, Severity.
# SupportedStylesAlignWith: keyword, variable, start_of_line
Layout/EndAlignment:
Exclude:
- 'db/migrate/20161006213403_rails_settings_migration.rb'

# Offense count: 19
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
Layout/ExtraSpacing:
Exclude:
- 'spec/config/initializers/rack_attack_spec.rb'
- 'spec/controllers/api/v2/filters/statuses_controller_spec.rb'
- 'spec/fabricators/custom_filter_keyword_fabricator.rb'
- 'spec/fabricators/poll_vote_fabricator.rb'
- 'spec/models/account_statuses_cleanup_policy_spec.rb'
- 'spec/services/activitypub/process_status_update_service_spec.rb'
- 'spec/services/import_service_spec.rb'
- 'spec/services/resolve_account_service_spec.rb'
- 'spec/services/resolve_url_service_spec.rb'
- 'spec/validators/note_length_validator_spec.rb'
- 'spec/validators/unreserved_username_validator_spec.rb'
- 'spec/workers/activitypub/move_distribution_worker_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
Layout/FirstArgumentIndentation:
Exclude:
- 'spec/services/remove_status_service_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
Layout/FirstArrayElementIndentation:
Exclude:
- 'spec/controllers/admin/dashboard_controller_spec.rb'
- 'spec/workers/activitypub/move_distribution_worker_spec.rb'

# Offense count: 113
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
Expand All @@ -276,174 +162,13 @@ Layout/HashAlignment:
- 'spec/models/admin/account_action_spec.rb'
- 'spec/models/concerns/account_interactions_spec.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
Layout/HeredocIndentation:
Exclude:
- 'spec/controllers/well_known/host_meta_controller_spec.rb'
- 'spec/lib/link_details_extractor_spec.rb'

# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: normal, indented_internal_methods
Layout/IndentationConsistency:
Exclude:
- 'spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb'
- 'spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb'
- 'spec/models/trends/statuses_spec.rb'
- 'spec/services/import_service_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Width, AllowedPatterns.
Layout/IndentationWidth:
Exclude:
- 'db/migrate/20161006213403_rails_settings_migration.rb'
- 'spec/controllers/api/v1/accounts/credentials_controller_spec.rb'
- 'spec/services/account_statuses_cleanup_service_spec.rb'
- 'spec/services/import_service_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
Layout/LeadingCommentSpace:
Exclude:
- 'lib/paperclip/attachment_extensions.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: space, no_space
Layout/LineContinuationSpacing:
Exclude:
- 'spec/support/stories/profile_stories.rb'

# Offense count: 577
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Enabled: false

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: symmetrical, new_line, same_line
Layout/MultilineMethodCallBraceLayout:
Exclude:
- 'spec/models/account_statuses_cleanup_policy_spec.rb'
- 'spec/services/activitypub/process_status_update_service_spec.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
# SupportedStylesForExponentOperator: space, no_space
Layout/SpaceAroundOperators:
Exclude:
- 'spec/services/activitypub/fetch_remote_status_service_spec.rb'
- 'spec/validators/note_length_validator_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceBeforeBlockBraces:
Exclude:
- 'spec/controllers/api/v1/reports_controller_spec.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment.
Layout/SpaceBeforeFirstArg:
Exclude:
- 'spec/fabricators/custom_filter_keyword_fabricator.rb'
- 'spec/fabricators/poll_vote_fabricator.rb'
- 'spec/models/concerns/account_interactions_spec.rb'

# Offense count: 24
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBrackets: space, no_space
Layout/SpaceInsideArrayLiteralBrackets:
Exclude:
- 'db/migrate/20161006213403_rails_settings_migration.rb'
- 'spec/controllers/settings/applications_controller_spec.rb'
- 'spec/lib/extractor_spec.rb'
- 'spec/models/export_spec.rb'
- 'spec/services/activitypub/process_account_service_spec.rb'
- 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
# SupportedStyles: space, no_space
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideBlockBraces:
Exclude:
- 'spec/lib/fast_ip_map_spec.rb'
- 'spec/models/user_role_spec.rb'
- 'spec/serializers/rest/account_serializer_spec.rb'
- 'spec/workers/activitypub/distribution_worker_spec.rb'

# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideHashLiteralBraces:
Exclude:
- 'app/lib/activitypub/activity/create.rb'
- 'app/services/activitypub/fetch_replies_service.rb'
- 'spec/services/activitypub/process_collection_service_spec.rb'
- 'spec/services/update_status_service_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: space, compact, no_space
Layout/SpaceInsideParens:
Exclude:
- 'spec/validators/unreserved_username_validator_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: space, no_space
Layout/SpaceInsideStringInterpolation:
Exclude:
- 'spec/controllers/auth/sessions_controller_spec.rb'
- 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb'
- 'spec/services/activitypub/process_account_service_spec.rb'

# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: final_newline, final_blank_line
Layout/TrailingEmptyLines:
Exclude:
- 'db/migrate/20190306145741_add_lock_version_to_polls.rb'
- 'db/migrate/20190807135426_add_comments_to_domain_blocks.rb'
- 'db/migrate/20200312162302_add_status_ids_to_announcements.rb'
- 'db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb'
- 'db/migrate/20200628133322_create_account_notes.rb'
- 'db/migrate/20210722120340_create_account_statuses_cleanup_policies.rb'
- 'spec/fabricators/ip_block_fabricator.rb'
- 'spec/fabricators/status_edit_fabricator.rb'

# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'app/models/concerns/expireable.rb'
- 'db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb'
- 'lib/tasks/mastodon.rake'
- 'spec/models/account/field_spec.rb'
- 'spec/services/remove_from_follwers_service_spec.rb'

# Offense count: 14
# Configuration parameters: AllowedMethods, AllowedPatterns.
Lint/AmbiguousBlockAssociation:
Expand Down
4 changes: 2 additions & 2 deletions app/lib/activitypub/activity/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def poll_vote!
def resolve_thread(status)
return unless status.reply? && status.thread.nil? && Request.valid_url?(in_reply_to_uri)

ThreadResolveWorker.perform_async(status.id, in_reply_to_uri, { 'request_id' => @options[:request_id]})
ThreadResolveWorker.perform_async(status.id, in_reply_to_uri, { 'request_id' => @options[:request_id] })
end

def fetch_replies(status)
Expand All @@ -338,7 +338,7 @@ def fetch_replies(status)
return unless replies.nil?

uri = value_or_id(collection)
ActivityPub::FetchRepliesWorker.perform_async(status.id, uri, { 'request_id' => @options[:request_id]}) unless uri.nil?
ActivityPub::FetchRepliesWorker.perform_async(status.id, uri, { 'request_id' => @options[:request_id] }) unless uri.nil?
end

def conversation_from_uri(uri)
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/expireable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def expires_in
end

def expires_in=(interval)
self.expires_at = interval.present? ? interval.to_i.seconds.from_now : nil
self.expires_at = interval.present? ? interval.to_i.seconds.from_now : nil
@expires_in = interval
end

Expand Down
2 changes: 1 addition & 1 deletion app/services/activitypub/fetch_replies_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def call(parent_status, collection_or_uri, allow_synchronous_requests: true, req
@items = collection_items(collection_or_uri)
return if @items.nil?

FetchReplyWorker.push_bulk(filtered_replies) { |reply_uri| [reply_uri, { 'request_id' => request_id}] }
FetchReplyWorker.push_bulk(filtered_replies) { |reply_uri| [reply_uri, { 'request_id' => request_id }] }

@items
end
Expand Down
10 changes: 5 additions & 5 deletions db/migrate/20161006213403_rails_settings_migration.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
MIGRATION_BASE_CLASS = if ActiveRecord::VERSION::MAJOR >= 5
ActiveRecord::Migration[5.0]
else
ActiveRecord::Migration[4.2]
end
ActiveRecord::Migration[5.0]
else
ActiveRecord::Migration[4.2]
end

class RailsSettingsMigration < MIGRATION_BASE_CLASS
def self.up
Expand All @@ -12,7 +12,7 @@ def self.up
t.references :target, null: false, polymorphic: true, index: { name: 'index_settings_on_target_type_and_target_id' }
t.timestamps null: true
end
add_index :settings, [ :target_type, :target_id, :var ], unique: true
add_index :settings, [:target_type, :target_id, :var], unique: true
end

def self.down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ class ImproveIndexOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Mi
disable_ddl_transaction!

def change
# These changes ware reverted by migration 20180514140000.
# add_index :statuses, [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2)', algorithm: :concurrently
# add_index :statuses, [:account_id, :id], where: 'visibility = 3', algorithm: :concurrently
# remove_index :statuses, column: [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106
# These changes ware reverted by migration 20180514140000.
# add_index :statuses, [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2)', algorithm: :concurrently
# add_index :statuses, [:account_id, :id], where: 'visibility = 3', algorithm: :concurrently
# remove_index :statuses, column: [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106
end
end
1 change: 0 additions & 1 deletion db/migrate/20190306145741_add_lock_version_to_polls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ def down
remove_column :polls, :lock_version
end
end

1 change: 0 additions & 1 deletion db/migrate/20190807135426_add_comments_to_domain_blocks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ def change
add_column :domain_blocks, :public_comment, :text
end
end

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ def change
add_column :announcements, :status_ids, :bigint, array: true
end
end

0 comments on commit aa020c5

Please sign in to comment.