From 34261372a4f51fce3e1b8ceb0d81784df0d8b1d7 Mon Sep 17 00:00:00 2001 From: Sam Bostock Date: Fri, 25 Mar 2022 17:40:22 -0400 Subject: [PATCH] Fix existing offenses for Security/CompoundHash Co-authored-by: Chris Seaton --- lib/rubocop/cop/offense.rb | 2 +- lib/rubocop/cop/variable_force/branch.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rubocop/cop/offense.rb b/lib/rubocop/cop/offense.rb index eba5098e0786..cd4ea7ec8834 100644 --- a/lib/rubocop/cop/offense.rb +++ b/lib/rubocop/cop/offense.rb @@ -217,7 +217,7 @@ def ==(other) alias eql? == def hash - COMPARISON_ATTRIBUTES.reduce(0) { |hash, attribute| hash ^ public_send(attribute).hash } + COMPARISON_ATTRIBUTES.map { |attribute| public_send(attribute) }.hash end # @api public diff --git a/lib/rubocop/cop/variable_force/branch.rb b/lib/rubocop/cop/variable_force/branch.rb index ffc3eb72bb3c..6f42f9605097 100644 --- a/lib/rubocop/cop/variable_force/branch.rb +++ b/lib/rubocop/cop/variable_force/branch.rb @@ -127,7 +127,7 @@ def ==(other) alias_method :eql?, :== def hash - control_node.object_id.hash ^ child_node.object_id.hash + [control_node.object_id, control_node.object_id].hash end private