From 23148dc536bd25b2aea6324e89f6fc85afa569ee Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 29 Jan 2026 05:14:14 -0500 Subject: [PATCH] Update rubocop to version 1.8.40 (#37628) --- Gemfile.lock | 4 ++-- .../metrics/dimension/tag_servers_dimension.rb | 2 +- app/models/concerns/status/threading_concern.rb | 4 ++-- app/services/notify_service.rb | 2 +- app/workers/move_worker.rb | 14 +++++++------- ...0180608213548_reject_following_blocked_users.rb | 4 ++-- db/migrate/20180812173710_copy_status_stats.rb | 2 +- db/migrate/20181116173541_copy_account_stats.rb | 2 +- .../20220613110711_migrate_custom_filters.rb | 6 +++--- ...190519130537_remove_boosts_widening_audience.rb | 2 +- ...0729171123_fix_custom_filter_keywords_id_seq.rb | 2 +- lib/mastodon/cli/statuses.rb | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b050d5ad635..ee26939a26c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -754,7 +754,7 @@ GEM rspec-mocks (~> 3.0) sidekiq (>= 5, < 9) rspec-support (3.13.6) - rubocop (1.82.1) + rubocop (1.84.0) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -762,7 +762,7 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.48.0, < 2.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.49.0) diff --git a/app/lib/admin/metrics/dimension/tag_servers_dimension.rb b/app/lib/admin/metrics/dimension/tag_servers_dimension.rb index 29145e14871..ee40d2c9c86 100644 --- a/app/lib/admin/metrics/dimension/tag_servers_dimension.rb +++ b/app/lib/admin/metrics/dimension/tag_servers_dimension.rb @@ -22,7 +22,7 @@ class Admin::Metrics::Dimension::TagServersDimension < Admin::Metrics::Dimension end def sql_query_string - <<-SQL.squish + <<~SQL.squish SELECT accounts.domain, count(*) AS value FROM statuses INNER JOIN accounts ON accounts.id = statuses.account_id diff --git a/app/models/concerns/status/threading_concern.rb b/app/models/concerns/status/threading_concern.rb index 3b0a3cd0281..91b3450f949 100644 --- a/app/models/concerns/status/threading_concern.rb +++ b/app/models/concerns/status/threading_concern.rb @@ -49,7 +49,7 @@ module Status::ThreadingConcern end def ancestor_statuses(limit) - Status.find_by_sql([<<-SQL.squish, id: in_reply_to_id, limit: limit]) + Status.find_by_sql([<<~SQL.squish, id: in_reply_to_id, limit: limit]) WITH RECURSIVE search_tree(id, in_reply_to_id, path) AS ( SELECT id, in_reply_to_id, ARRAY[id] @@ -73,7 +73,7 @@ module Status::ThreadingConcern depth += 1 if depth.present? limit += 1 if limit.present? - descendants_with_self = Status.find_by_sql([<<-SQL.squish, id: id, limit: limit, depth: depth]) + descendants_with_self = Status.find_by_sql([<<~SQL.squish, id: id, limit: limit, depth: depth]) WITH RECURSIVE search_tree(id, path) AS ( SELECT id, ARRAY[id] FROM statuses diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index 0c40e7b3a8b..2f009d5a23b 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -84,7 +84,7 @@ class NotifyService < BaseService # This queries private mentions from the recipient to the sender up in the thread. # This allows up to 100 messages that do not match in the thread, allowing conversations # involving multiple people. - Status.count_by_sql([<<-SQL.squish, id: @notification.target_status.in_reply_to_id, recipient_id: @recipient.id, sender_id: @sender.id, depth_limit: 100]) + Status.count_by_sql([<<~SQL.squish, id: @notification.target_status.in_reply_to_id, recipient_id: @recipient.id, sender_id: @sender.id, depth_limit: 100]) WITH RECURSIVE ancestors(id, in_reply_to_id, mention_id, path, depth) AS ( SELECT s.id, s.in_reply_to_id, m.id, ARRAY[s.id], 0 FROM statuses s diff --git a/app/workers/move_worker.rb b/app/workers/move_worker.rb index eb0ba5e1bb5..14cb47a27f0 100644 --- a/app/workers/move_worker.rb +++ b/app/workers/move_worker.rb @@ -48,11 +48,11 @@ class MoveWorker source_local_followers .where(account: @target_account.followers.local) .in_batches do |follows| - ListAccount.where(follow: follows).includes(:list).find_each do |list_account| - list_account.list.accounts << @target_account - rescue ActiveRecord::RecordInvalid - nil - end + ListAccount.where(follow: follows).includes(:list).find_each do |list_account| + list_account.list.accounts << @target_account + rescue ActiveRecord::RecordInvalid + nil + end end # Finally, handle the common case of accounts not following the new account @@ -60,8 +60,8 @@ class MoveWorker .where.not(account: @target_account.followers.local) .where.not(account_id: @target_account.id) .in_batches do |follows| - ListAccount.where(follow: follows).in_batches.update_all(account_id: @target_account.id) - num_moved += follows.update_all(target_account_id: @target_account.id) + ListAccount.where(follow: follows).in_batches.update_all(account_id: @target_account.id) + num_moved += follows.update_all(target_account_id: @target_account.id) end num_moved diff --git a/db/migrate/20180608213548_reject_following_blocked_users.rb b/db/migrate/20180608213548_reject_following_blocked_users.rb index 4cb6395469c..a82bff62b41 100644 --- a/db/migrate/20180608213548_reject_following_blocked_users.rb +++ b/db/migrate/20180608213548_reject_following_blocked_users.rb @@ -4,14 +4,14 @@ class RejectFollowingBlockedUsers < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - blocked_follows = Follow.find_by_sql(<<-SQL.squish) + blocked_follows = Follow.find_by_sql(<<~SQL.squish) select f.* from follows f inner join blocks b on f.account_id = b.target_account_id and f.target_account_id = b.account_id SQL - domain_blocked_follows = Follow.find_by_sql(<<-SQL.squish) + domain_blocked_follows = Follow.find_by_sql(<<~SQL.squish) select f.* from follows f inner join accounts following on f.account_id = following.id inner join account_domain_blocks b on diff --git a/db/migrate/20180812173710_copy_status_stats.rb b/db/migrate/20180812173710_copy_status_stats.rb index 087b1290dbc..74c4fe03871 100644 --- a/db/migrate/20180812173710_copy_status_stats.rb +++ b/db/migrate/20180812173710_copy_status_stats.rb @@ -27,7 +27,7 @@ class CopyStatusStats < ActiveRecord::Migration[5.2] say 'Upsert is available, importing counters using the fast method' Status.unscoped.select('id').find_in_batches(batch_size: 5_000) do |statuses| - execute <<-SQL.squish + execute <<~SQL.squish INSERT INTO status_stats (status_id, reblogs_count, favourites_count, created_at, updated_at) SELECT id, reblogs_count, favourites_count, created_at, updated_at FROM statuses diff --git a/db/migrate/20181116173541_copy_account_stats.rb b/db/migrate/20181116173541_copy_account_stats.rb index e5faee0cb5f..f80d71b7776 100644 --- a/db/migrate/20181116173541_copy_account_stats.rb +++ b/db/migrate/20181116173541_copy_account_stats.rb @@ -31,7 +31,7 @@ class CopyAccountStats < ActiveRecord::Migration[5.2] say 'Upsert is available, importing counters using the fast method' MigrationAccount.unscoped.select('id').find_in_batches(batch_size: 5_000) do |accounts| - execute <<-SQL.squish + execute <<~SQL.squish INSERT INTO account_stats (account_id, statuses_count, following_count, followers_count, created_at, updated_at) SELECT id, statuses_count, following_count, followers_count, created_at, updated_at FROM accounts diff --git a/db/migrate/20220613110711_migrate_custom_filters.rb b/db/migrate/20220613110711_migrate_custom_filters.rb index ea6a9b8c6d1..f3b2e01a06a 100644 --- a/db/migrate/20220613110711_migrate_custom_filters.rb +++ b/db/migrate/20220613110711_migrate_custom_filters.rb @@ -5,7 +5,7 @@ class MigrateCustomFilters < ActiveRecord::Migration[6.1] # Preserve IDs as much as possible to not confuse existing clients. # As long as this migration is irreversible, we do not have to deal with conflicts. safety_assured do - execute <<-SQL.squish + execute <<~SQL.squish INSERT INTO custom_filter_keywords (id, custom_filter_id, keyword, whole_word, created_at, updated_at) SELECT id, id, phrase, whole_word, created_at, updated_at FROM custom_filters @@ -16,7 +16,7 @@ class MigrateCustomFilters < ActiveRecord::Migration[6.1] def down # Copy back changes from custom filters guaranteed to be from the old API safety_assured do - execute <<-SQL.squish + execute <<~SQL.squish UPDATE custom_filters SET phrase = custom_filter_keywords.keyword, whole_word = custom_filter_keywords.whole_word FROM custom_filter_keywords @@ -26,7 +26,7 @@ class MigrateCustomFilters < ActiveRecord::Migration[6.1] # Drop every keyword as we can't safely provide a 1:1 mapping safety_assured do - execute <<-SQL.squish + execute <<~SQL.squish TRUNCATE custom_filter_keywords RESTART IDENTITY SQL end diff --git a/db/post_migrate/20190519130537_remove_boosts_widening_audience.rb b/db/post_migrate/20190519130537_remove_boosts_widening_audience.rb index 89a95041ee0..8faeba7be0b 100644 --- a/db/post_migrate/20190519130537_remove_boosts_widening_audience.rb +++ b/db/post_migrate/20190519130537_remove_boosts_widening_audience.rb @@ -4,7 +4,7 @@ class RemoveBoostsWideningAudience < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - public_boosts = Status.find_by_sql(<<-SQL.squish) + public_boosts = Status.find_by_sql(<<~SQL.squish) SELECT boost.id FROM statuses AS boost LEFT JOIN statuses AS boosted ON boost.reblog_of_id = boosted.id diff --git a/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb b/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb index eb437c86c5a..edc689a7164 100644 --- a/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb +++ b/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb @@ -7,7 +7,7 @@ class FixCustomFilterKeywordsIdSeq < ActiveRecord::Migration[6.1] # 20220613110711 manually inserts items with set `id` in the database, but # we also need to bump the sequence number, otherwise safety_assured do - execute <<-SQL.squish + execute <<~SQL.squish BEGIN; LOCK TABLE custom_filter_keywords IN EXCLUSIVE MODE; SELECT setval('custom_filter_keywords_id_seq'::regclass, id) FROM custom_filter_keywords ORDER BY id DESC LIMIT 1; diff --git a/lib/mastodon/cli/statuses.rb b/lib/mastodon/cli/statuses.rb index 7188bc970ce..df0fcf0fbb0 100644 --- a/lib/mastodon/cli/statuses.rb +++ b/lib/mastodon/cli/statuses.rb @@ -52,7 +52,7 @@ module Mastodon::CLI # Skip accounts followed by local accounts clean_followed_sql = 'AND NOT EXISTS (SELECT 1 FROM follows WHERE statuses.account_id = follows.target_account_id)' unless options[:clean_followed] - ActiveRecord::Base.connection.exec_insert(<<-SQL.squish, 'SQL', [max_id]) + ActiveRecord::Base.connection.exec_insert(<<~SQL.squish, 'SQL', [max_id]) INSERT INTO statuses_to_be_deleted (id) SELECT statuses.id FROM statuses WHERE deleted_at IS NULL AND NOT local AND uri IS NOT NULL AND (id < $1) AND NOT EXISTS (SELECT 1 FROM statuses AS statuses1 WHERE statuses.id = statuses1.in_reply_to_id) @@ -137,7 +137,7 @@ module Mastodon::CLI ActiveRecord::Base.connection.create_table('conversations_to_be_deleted', force: true) - ActiveRecord::Base.connection.exec_insert(<<-SQL.squish, 'SQL') + ActiveRecord::Base.connection.exec_insert(<<~SQL.squish, 'SQL') INSERT INTO conversations_to_be_deleted (id) SELECT id FROM conversations WHERE NOT EXISTS (SELECT 1 FROM statuses WHERE statuses.conversation_id = conversations.id) SQL