Sha256: 3a2783365ce7540c86d939507f84a124e3a9b292969474ed59a3d03436ec6a61
Contents?: true
Size: 631 Bytes
Versions: 2
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gitlab-styles-13.0.1 | lib/rubocop/cop/polymorphic_associations.rb |
gitlab-styles-13.0.0 | lib/rubocop/cop/polymorphic_associations.rb |