class RuboCop::Cop::Sequel::ConcurrentIndex

ConcurrentIndex looks for non-concurrent index creation.

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/sequel/concurrent_index.rb, line 15
def on_send(node)
  indexes?(node) do |args|
    add_offense(node.loc.selector, message: MSG) if offensive?(args)
  end
end

Private Instance Methods

offensive?(args) click to toggle source
# File lib/rubocop/cop/sequel/concurrent_index.rb, line 23
def offensive?(args)
  !args.last.hash_type? || args.last.each_descendant.none? do |n|
    next unless n.sym_type?

    n.children.any? { |s| s == :concurrently }
  end
end