Class: Rubocop::Cop::Lint::AssignmentInCondition
- Defined in:
- lib/rubocop/cop/lint/assignment_in_condition.rb
Overview
This cop checks for assignments in the conditions of if/while/until.
Constant Summary collapse
- ASGN_NODES =
[:lvasgn, :ivasgn, :cvasgn, :gvasgn, :casgn]
- MSG =
'Assignment in condition - you probably meant to use ==.'
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?, #convention, #cop_config, cop_name, #cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, #message, non_rails, rails?, style?, #support_autocorrect?, #warning
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_if(node) ⇒ Object
12 13 14 |
# File 'lib/rubocop/cop/lint/assignment_in_condition.rb', line 12 def on_if(node) check(node) end |
#on_until(node) ⇒ Object
20 21 22 |
# File 'lib/rubocop/cop/lint/assignment_in_condition.rb', line 20 def on_until(node) check(node) end |
#on_while(node) ⇒ Object
16 17 18 |
# File 'lib/rubocop/cop/lint/assignment_in_condition.rb', line 16 def on_while(node) check(node) end |