Sha256: 69530bcea5cc7f4e9ddccd6069501de47cc1d4082a8aea962934ba4f5fe79d7f
Contents?: true
Size: 687 Bytes
Versions: 3
Compression:
Stored size: 687 Bytes
Contents
# frozen_string_literal: true require_relative '../../gitlab/styles/rubocop/model_helpers' module Rubocop module Cop # Cop that prevents the use of polymorphic associations class PolymorphicAssociations < RuboCop::Cop::Base include Gitlab::Styles::Rubocop::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) if key_name == :polymorphic end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems