Class: Ducalis::StandardMethods

Inherits:
RuboCop::Cop::Cop
  • Object
show all
Defined in:
lib/ducalis/cops/standard_methods.rb

Constant Summary collapse

BLACK_LIST =
[Object].flat_map { |klass| klass.new.methods }
OFFENSE =
<<-MESSAGE.gsub(/^ +\|\s/, '').strip
  | Please, be sure that you really want to redefine standard ruby methods.
  | You should know what are you doing and all consequences.
MESSAGE

Instance Method Summary collapse

Instance Method Details

#on_def(node) ⇒ Object



14
15
16
17
18
19
# File 'lib/ducalis/cops/standard_methods.rb', line 14

def on_def(node)
  name, _args, _body = *node
  return unless BLACK_LIST.include?(name)

  add_offense(node, :expression, OFFENSE)
end