Class: RuboCop::Cop::Academia::OnReplica

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/academia/on_replica.rb

Constant Summary collapse

MSG =
"Please use `Octopus.on_replica(:shard)` where :shard is the name of the database"

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/rubocop/cop/academia/on_replica.rb', line 9

def on_send(node)
  receiver, method_name, *args = *node

  return unless method_name == :on_replica
  return if match_octopus(receiver) && args.any?
  return if match_premium_analytics(receiver)

  add_offense(node)
end