class RuboCop::Cop::Lint::MultipleComparison
10 <= x && x <= 20
x < y && y < z
# good
@example
10 <= x <= 20
x < y < z
# bad
@example
comparison operators.
the comparison is not syntax error. This cop checks the bad usage of
multiple value. However, we can’t use the comparison in Ruby. However,
In math and Python, we can use ‘x < y < z` style comparison to compare
def on_send(node)
def on_send(node) return unless (center = multiple_compare?(node)) add_offense(node) do |corrector| new_center = "#{center.source} && #{center.source}" corrector.replace(center, new_center) end end