Sha256: 8543b1a5a89d4309372eca8a5bfb841c1874978d09611ed764cb9afc790e5674
Contents?: true
Size: 767 Bytes
Versions: 6
Compression:
Stored size: 767 Bytes
Contents
# frozen_string_literal: true require_relative '../model_helpers' module Gitlab module Styles module Rubocop module Cop # Cop that prevents the use of polymorphic associations class PolymorphicAssociations < RuboCop::Cop::Cop include ModelHelpers MSG = 'Do not use polymorphic associations, use separate tables instead' def on_send(node) return unless in_model?(node) return unless node.children[1] == :belongs_to node.children.last.each_node(:pair) do |pair| key_name = pair.children[0].children[0] add_offense(pair, location: :expression) if key_name == :polymorphic end end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems