Class: Rubocop::Cop::Proc
- Defined in:
- lib/rubocop/cop/proc.rb
Constant Summary collapse
- MSG =
'Use proc instead of Proc.new.'
- TARGET =
s(:send, s(:const, nil, :Proc), :new)
Instance Attribute Summary
Attributes inherited from Cop
#debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, cop_name, #has_report?, #ignore_node, inherited, #initialize, #inspect, #name
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_block(node) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubocop/cop/proc.rb', line 10 def on_block(node) # We're looking for # (block # (send # (const nil :Proc) :new) # ...) block_method, = *node if block_method == TARGET add_offence(:convention, block_method.loc.line, MSG) end super end |