From 88882fbbeefe0a5a91985a4c50c44f897e30aabd Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 2 May 2024 05:40:05 -0400 Subject: [PATCH] Move Rails/HABTM cop out of todo (#30118) --- .rubocop_todo.yml | 8 -------- app/models/concerns/account/associations.rb | 2 +- app/models/status.rb | 2 +- app/models/tag.rb | 2 ++ 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e656578149b..25b573017b8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -42,14 +42,6 @@ RSpec/MultipleMemoizedHelpers: RSpec/NestedGroups: Max: 6 -# Configuration parameters: Include. -# Include: app/models/**/*.rb -Rails/HasAndBelongsToMany: - Exclude: - - 'app/models/concerns/account/associations.rb' - - 'app/models/status.rb' - - 'app/models/tag.rb' - Rails/OutputSafety: Exclude: - 'config/initializers/simple_form.rb' diff --git a/app/models/concerns/account/associations.rb b/app/models/concerns/account/associations.rb index b2e9d255fd8..1c67b07e511 100644 --- a/app/models/concerns/account/associations.rb +++ b/app/models/concerns/account/associations.rb @@ -62,7 +62,7 @@ module Account::Associations has_many :aliases, class_name: 'AccountAlias', dependent: :destroy, inverse_of: :account # Hashtags - has_and_belongs_to_many :tags + has_and_belongs_to_many :tags # rubocop:disable Rails/HasAndBelongsToMany has_many :featured_tags, -> { includes(:tag) }, dependent: :destroy, inverse_of: :account # Account deletion requests diff --git a/app/models/status.rb b/app/models/status.rb index 2ff803bf0b3..0bb5c0ce235 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -82,7 +82,7 @@ class Status < ApplicationRecord has_many :local_reblogged, -> { merge(Account.local) }, through: :reblogs, source: :account has_many :local_bookmarked, -> { merge(Account.local) }, through: :bookmarks, source: :account - has_and_belongs_to_many :tags + has_and_belongs_to_many :tags # rubocop:disable Rails/HasAndBelongsToMany has_one :preview_cards_status, inverse_of: :status, dependent: :delete diff --git a/app/models/tag.rb b/app/models/tag.rb index 58baa48c05d..35be921e2d0 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -21,8 +21,10 @@ class Tag < ApplicationRecord include Paginable + # rubocop:disable Rails/HasAndBelongsToMany has_and_belongs_to_many :statuses has_and_belongs_to_many :accounts + # rubocop:enable Rails/HasAndBelongsToMany has_many :passive_relationships, class_name: 'TagFollow', inverse_of: :tag, dependent: :destroy has_many :featured_tags, dependent: :destroy, inverse_of: :tag