Sha256: 3a2783365ce7540c86d939507f84a124e3a9b292969474ed59a3d03436ec6a61
Contents?: true
Size: 631 Bytes
Versions: 4
Compression:
Stored size: 631 Bytes
Contents
# frozen_string_literal: true module Rubocop module Cop # Cop that prevents the use of polymorphic associations class PolymorphicAssociations < RuboCop::Cop::Base MSG = 'Do not use polymorphic associations, use separate tables instead' RESTRICT_ON_SEND = %i[belongs_to].to_set.freeze # @!method polymorphic_pair(node) def_node_matcher :polymorphic_pair, <<~PATTERN (send _ %RESTRICT_ON_SEND ... (hash <$(pair (sym :polymorphic) _) ...>)) PATTERN def on_send(node) polymorphic_pair(node) do |pair| add_offense(pair) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems