From 3e336fe706a7b745c97efaca402e75a8ec5a7aeb Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 15 Dec 2023 09:38:12 -0500 Subject: [PATCH] Opt out of `Rails/SkipsModelValidations` cop in db/migrate (#28371) --- .rubocop.yml | 4 ++++ .rubocop_todo.yml | 16 ---------------- db/migrate/20230215074423_move_user_settings.rb | 2 +- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 68352e3198..2221604224 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -105,6 +105,10 @@ Rails/Exit: - 'config/boot.rb' - 'lib/mastodon/cli/*.rb' +Rails/SkipsModelValidations: + Exclude: + - 'db/*migrate/**/*' + # Reason: Some single letter camel case files shouldn't be split # https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecfilepath RSpec/FilePath: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c323aa877b..7d05090b39 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -181,22 +181,6 @@ Rails/SkipsModelValidations: - 'app/workers/move_worker.rb' - 'app/workers/scheduler/ip_cleanup_scheduler.rb' - 'app/workers/scheduler/scheduled_statuses_scheduler.rb' - - 'db/migrate/20161203164520_add_from_account_id_to_notifications.rb' - - 'db/migrate/20170105224407_add_shortcode_to_media_attachments.rb' - - 'db/migrate/20170209184350_add_reply_to_statuses.rb' - - 'db/migrate/20170304202101_add_type_to_media_attachments.rb' - - 'db/migrate/20180528141303_fix_accounts_unique_index.rb' - - 'db/migrate/20180609104432_migrate_web_push_subscriptions2.rb' - - 'db/migrate/20181207011115_downcase_custom_emoji_domains.rb' - - 'db/migrate/20190511134027_add_silenced_at_suspended_at_to_accounts.rb' - - 'db/migrate/20191007013357_update_pt_locales.rb' - - 'db/migrate/20220316233212_update_kurdish_locales.rb' - - 'db/post_migrate/20190511152737_remove_suspended_silenced_account_fields.rb' - - 'db/post_migrate/20200917193528_migrate_notifications_type.rb' - - 'db/post_migrate/20201017234926_fill_account_suspension_origin.rb' - - 'db/post_migrate/20220617202502_migrate_roles.rb' - - 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb' - - 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb' - 'lib/mastodon/cli/accounts.rb' - 'lib/mastodon/cli/maintenance.rb' - 'spec/lib/activitypub/activity/follow_spec.rb' diff --git a/db/migrate/20230215074423_move_user_settings.rb b/db/migrate/20230215074423_move_user_settings.rb index 27caac1011..86231e49e8 100644 --- a/db/migrate/20230215074423_move_user_settings.rb +++ b/db/migrate/20230215074423_move_user_settings.rb @@ -80,7 +80,7 @@ class MoveUserSettings < ActiveRecord::Migration[6.1] end end - user.update_column('settings', Oj.dump(user_settings)) # rubocop:disable Rails/SkipsModelValidations + user.update_column('settings', Oj.dump(user_settings)) end end end