Class: Rubocop::Cop::Lint::UselessSetterCall
- Defined in:
- lib/rubocop/cop/lint/useless_setter_call.rb
Overview
This cop checks for setter call to local variable as the final expression of a function definition.
Defined Under Namespace
Classes: MethodVariableTracker
Constant Summary collapse
- MSG =
'Useless setter call to local variable %s.'
- ASSIGNMENT_TYPES =
[:lvasgn, :ivasgn, :cvasgn, :gvasgn].freeze
Constants inherited from Cop
Instance Attribute Summary
Attributes inherited from Cop
#config, #corrections, #offences, #processed_source
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect?, #autocorrect_action, #convention, #cop_config, #cop_name, cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, #message, rails?, style?, #warning
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_def(node) ⇒ Object
19 20 21 22 23 |
# File 'lib/rubocop/cop/lint/useless_setter_call.rb', line 19 def on_def(node) _name, args, body = *node check_for_useless_assignment(body, args) end |
#on_defs(node) ⇒ Object
25 26 27 28 29 |
# File 'lib/rubocop/cop/lint/useless_setter_call.rb', line 25 def on_defs(node) _target, _name, args, body = *node check_for_useless_assignment(body, args) end |