Sha256: d563b916f79dea09c03676a1d86507cf491c863c1812d70cae6ec06b50681cc7
Contents?: true
Size: 789 Bytes
Versions: 3
Compression:
Stored size: 789 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Sequel # ConcurrentIndex looks for non-concurrent index creation. class ConcurrentIndex < Base MSG = 'Prefer creating or dropping new index concurrently' def_node_matcher :indexes?, <<-MATCHER (send _ {:add_index :drop_index} $...) MATCHER def on_send(node) indexes?(node) do |args| add_offense(node.loc.selector, message: MSG) if offensive?(args) end end private 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 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems