summaryrefslogtreecommitdiff
path: root/rubocop/cop/in_batches.rb
blob: c0240187e66139292b3da6ce45b3e35b32f35734 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require_relative '../model_helpers'

module RuboCop
  module Cop
    # Cop that prevents the use of `in_batches`
    class InBatches < RuboCop::Cop::Cop
      MSG = 'Do not use `in_batches`, use `each_batch` from the EachBatch module instead'.freeze

      def on_send(node)
        return unless node.children[1] == :in_batches

        add_offense(node, :selector)
      end
    end
  end
end