class RuboCop::Cop::Rails::HasManyOrHasOneDependent

end
has_many :patients, through: :appointments
has_one :avatar, dependent: :destroy
has_many :comments, dependent: :restrict_with_exception
class User < ActiveRecord::Base
# good
end
has_one :avatar
has_many :comments
class User < ActiveRecord::Base
# bad
@example
It doesn’t register an offense if ‘:through` option was specified.
specify a `:dependent` option.
This cop looks for `has_many` or `has_one` associations that don’t

def active_resource?(node)

def active_resource?(node)
  return false if node.nil?
  active_resource_class?(node)
end

def contain_valid_options_in_with_options_block?(node)

def contain_valid_options_in_with_options_block?(node)
  if with_options_block(node)
    return true if valid_options?(with_options_block(node))
    return false unless node.parent
    return true if contain_valid_options_in_with_options_block?(
      node.parent.parent
    )
  end
  false
end

def on_send(node)

def on_send(node)
  return if active_resource?(node.parent)
  unless association_without_options?(node)
    return if valid_options?(association_with_options?(node))
  end
  return if valid_options_in_with_options_block?(node)
  add_offense(node, location: :selector)
end

def valid_options?(options)

def valid_options?(options)
  return true unless options
  return true if options.any? do |o|
    dependent_option?(o) || present_option?(o)
  end
  false
end

def valid_options_in_with_options_block?(node)

def valid_options_in_with_options_block?(node)
  return true unless node.parent
  n = node.parent.begin_type? ? node.parent.parent : node.parent
  contain_valid_options_in_with_options_block?(n)
end