require_relative'../model_helpers'moduleRuboCopmoduleCop# Cop that prevents the use of `dependent: ...` in ActiveRecord models.classActiveRecordDependent<RuboCop::Cop::CopincludeModelHelpersMSG='Do not use `dependent: to remove associated data, '\'use foreign keys with cascading deletes instead'.freezeMETHOD_NAMES=[:has_many,:has_one,:belongs_to].freezedefon_send(node)returnunlessin_model?(node)returnunlessMETHOD_NAMES.include?(node.children[1])node.children.last.each_node(:pair)do|pair|key_name=pair.children[0].children[0]add_offense(pair,:expression)ifkey_name==:dependentendendendendend