Ruby

Ruby

By DeepSource

Manually combining hashes is error prone RB-W1000

Anti-pattern

Manually combining hashes is error prone and hard to follow, especially when there are many values. Poor implementations may also introduce performance or security concerns if they are prone to collisions. Delegating to Array#hash is clearer, faster, and safer.

Bad practice

def hash
  @foo ^ @bar
end

Recommended

def hash
  [@foo, @bar].hash
end