Class: Rubocop::Cop::Style::RedundantReturn
- Defined in:
- lib/rubocop/cop/style/redundant_return.rb
Overview
This cop checks for redundant return
expressions.
It should be extended to handle methods whose body is if/else or a case expression with a default branch.
Constant Summary collapse
- MSG =
'Redundant `return` detected.'
Instance Attribute Summary
Attributes inherited from Cop
#autocorrect, #corrections, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect_action, cop_name, cop_type, #do_autocorrect, #ignore_node, inherited, #initialize, lint?, #name, rails?, style?
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_def(node) ⇒ Object
26 27 28 29 30 |
# File 'lib/rubocop/cop/style/redundant_return.rb', line 26 def on_def(node) _method_name, _args, body = *node check(body) end |
#on_defs(node) ⇒ Object
32 33 34 35 36 |
# File 'lib/rubocop/cop/style/redundant_return.rb', line 32 def on_defs(node) _scope, _method_name, _args, body = *node check(body) end |