Class: Rubocop::Cop::Lint::Eval
- Defined in:
- lib/rubocop/cop/lint/eval.rb
Overview
This cop checks for the use of Kernel#eval.
Constant Summary collapse
- MSG =
'The use of eval is a serious security risk.'
Instance Attribute Summary
Attributes inherited from Cop
#autocorrect, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, #autocorrect_action, cop_name, cop_type, #do_autocorrect, #ignore_node, inherited, #initialize, #inspect, lint?, #name, rails?, style?
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_send(node) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/rubocop/cop/lint/eval.rb', line 10 def on_send(node) receiver, method_name, = *node if receiver.nil? && method_name == :eval add_offence(:warning, node.loc.selector, MSG) end super end |