Parent

Roodi::Checks::AssignmentInConditionalCheck

Checks a conditional to see if it contains an assignment.

A conditional containing an assignment is likely to be a mistyped equality check. You should either fix the typo or factor out the assignment so that the code is clearer.

Public Class Methods

new(options = {}) click to toggle source
# File lib/roodi/checks/assignment_in_conditional_check.rb, line 10
def initialize(options = {})
  super()
end

Public Instance Methods

evaluate_start(node) click to toggle source
# File lib/roodi/checks/assignment_in_conditional_check.rb, line 18
def evaluate_start(node)
  add_error("Found = in conditional.  It should probably be an ==") if has_assignment?(node[1])
end
interesting_nodes() click to toggle source
# File lib/roodi/checks/assignment_in_conditional_check.rb, line 14
def interesting_nodes
  [:if, :while]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.