Class: RuboCop::Cop::Sequel::PartialConstraint

Inherits:
Base
  • Object
show all
Includes:
Helpers::Migration
Defined in:
lib/rubocop/cop/sequel/partial_constraint.rb

Overview

PartialConstraint looks for missed usage of partial indexes.

Constant Summary collapse

MSG =
"Constraint can't be partial, use where argument with index"
RESTRICT_ON_SEND =
%i[add_unique_constraint].freeze

Instance Method Summary collapse

Methods included from Helpers::Migration

#within_sequel_migration?

Instance Method Details

#on_send(node) ⇒ Object



17
18
19
20
21
22
# File 'lib/rubocop/cop/sequel/partial_constraint.rb', line 17

def on_send(node)
  return unless add_partial_constraint?(node)
  return unless within_sequel_migration?(node)

  add_offense(node.loc.selector, message: MSG)
end