Class: RuboCop::Cop::SidekiqEnt::Base Abstract

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

Overview

This class is abstract.

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

Instance Method Summary collapse

Methods included from Sidekiq::Language

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

Instance Method Details

#limiter_creation?(node) ⇒ Object

Detect Sidekiq::Limiter.concurrent/bucket/window/leaky



15
16
17
18
19
20
21
22
23
# File 'lib/rubocop/cop/sidekiq_ent/base.rb', line 15

def_node_matcher :limiter_creation?, <<~PATTERN
  (send
    (const (const {nil? cbase} :Sidekiq) :Limiter)
    ${:concurrent :bucket :window :leaky}
    $_
    $_
    ...
  )
PATTERN

#unique_for_option?(node) ⇒ Object

Detect sidekiq_options with unique_for



27
28
29
30
31
# File 'lib/rubocop/cop/sidekiq_ent/base.rb', line 27

def_node_matcher :unique_for_option?, <<~PATTERN
  (send nil? :sidekiq_options
    (hash <(pair (sym :unique_for) $_) ...>)
  )
PATTERN

#unique_until_option?(node) ⇒ Object

Detect sidekiq_options with unique_until



35
36
37
38
39
# File 'lib/rubocop/cop/sidekiq_ent/base.rb', line 35

def_node_matcher :unique_until_option?, <<~PATTERN
  (send nil? :sidekiq_options
    (hash <(pair (sym :unique_until) $_) ...>)
  )
PATTERN