Class: Nucop::NoCoreMethodOverrides

Inherits:
RuboCop::Cop::Cop
  • Object
show all
Defined in:
lib/nucop/cops/no_core_method_overrides.rb

Overview

This cop looks for core method overrides

Examples:


# bad

def blank?
  # ...
end

# good

def anything_other_than_blank?
  # ...
end

Constant Summary collapse

MSG =
"Core method overridden".freeze

Instance Method Summary collapse

Instance Method Details

#on_def(node) ⇒ Object



25
26
27
28
29
# File 'lib/nucop/cops/no_core_method_overrides.rb', line 25

def on_def(node)
  core_methods(node) do |method|
    add_offense(node, location: :expression, message: format(MSG, method: method))
  end
end