Class: RuboCop::Cop::SidekiqPro::Base Abstract

Inherits:
Base
  • Object
show all
Includes:
Sidekiq::Language
Defined in:
lib/rubocop/cop/sidekiq_pro/base.rb

Overview

This class is abstract.

Base class for Sidekiq Pro cops. Provides common functionality for detecting Pro-specific patterns.

Instance Method Summary collapse

Methods included from Sidekiq::Language

#active_job_class?, #perform_call?, #sidekiq_include?, #sidekiq_options_call?

Instance Method Details

#batch_description_set?(node) ⇒ Object

Detect batch.description= assignment



33
34
35
# File 'lib/rubocop/cop/sidekiq_pro/base.rb', line 33

def_node_matcher :batch_description_set?, <<~PATTERN
  (send $_ :description= $_)
PATTERN

#batch_jobs_block?(node) ⇒ Object

Detect batch.jobs block



21
22
23
# File 'lib/rubocop/cop/sidekiq_pro/base.rb', line 21

def_node_matcher :batch_jobs_block?, <<~PATTERN
  (block (send $_ :jobs) _ $_)
PATTERN

#batch_new?(node) ⇒ Object

Detect Sidekiq::Batch.new



15
16
17
# File 'lib/rubocop/cop/sidekiq_pro/base.rb', line 15

def_node_matcher :batch_new?, <<~PATTERN
  (send (const (const {nil? cbase} :Sidekiq) :Batch) :new ...)
PATTERN

#batch_on_callback?(node) ⇒ Object

Detect batch.on callback registration



27
28
29
# File 'lib/rubocop/cop/sidekiq_pro/base.rb', line 27

def_node_matcher :batch_on_callback?, <<~PATTERN
  (send $_ :on (sym $_) $...)
PATTERN