Class: GLRubocop::GLCops::SidekiqInheritsFromSidekiqJob

Inherits:
RuboCop::Cop::Cop
  • Object
show all
Defined in:
lib/gl_rubocop/gl_cops/sidekiq_inherits_from_sidekiq_job.rb

Constant Summary collapse

MSG =
'All Sidekiq workers and jobs should inherit from SidekiqJob'.freeze

Instance Method Summary collapse

Instance Method Details

#on_class(klass) ⇒ Object



4
5
6
7
8
9
# File 'lib/gl_rubocop/gl_cops/sidekiq_inherits_from_sidekiq_job.rb', line 4

def on_class(klass)
  return unless klass.instance_of?(RuboCop::AST::ClassNode)
  return if klass.parent_class.present? || klass.identifier.short_name == :SidekiqJob

  add_offense(klass)
end