Class: RuboCop::Cop::G2::BanDecorators

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/g2/ban_decorators.rb

Constant Summary collapse

MSG =
'Please avoid creating new Draper decorators or extending existing decorators.'.freeze
DECORATOR_CLASSES =
%w(Draper::Decorator).freeze

Instance Method Summary collapse

Instance Method Details

#on_class(node) ⇒ Object



9
10
11
12
# File 'lib/rubocop/cop/g2/ban_decorators.rb', line 9

def on_class(node)
  parent_class = full_class_name(node)
  add_offense(node, location: :expression) if DECORATOR_CLASSES.include?(parent_class)
end