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 ==.'
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, #do_autocorrect, #ignore_node, inherited, #initialize, #inspect, #name, rails?
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_if(node) ⇒ Object
12 13 14 15 |
# File 'lib/rubocop/cop/lint/assignment_in_condition.rb', line 12 def on_if(node) check(node) super end |
#on_until(node) ⇒ Object
22 23 24 25 |
# File 'lib/rubocop/cop/lint/assignment_in_condition.rb', line 22 def on_until(node) check(node) super end |
#on_while(node) ⇒ Object
17 18 19 20 |
# File 'lib/rubocop/cop/lint/assignment_in_condition.rb', line 17 def on_while(node) check(node) super end |