Ruby

Ruby

Made by DeepSource

Binary operator with identical operands detected RB-LI1093

Anti-pattern
Major

It covers arithmetic operators: +, -, , /, %, *; comparison operators: ==, ===, =~, >, >=, <, ⇐; bitwise operators: |, ^, &, <<, >>; boolean operators: &&, || and "spaceship" operator - <⇒.

This check is unsafe as it does not consider side effects when calling methods and thus can generate false positives.

Bad practice

x.top >= x.top

if a.x != 0 && a.x != 0
  do_something
end

def childs?
  left_child || left_child
end