From 3e001d29ccdb5a5b1ba223710525f8dc7ae844ee Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 24 Jul 2019 11:11:18 -0700 Subject: Enable Rubocop Performance/InefficientHashSearch When used with a Hash, `.keys.include?` is bad because: 1. It performs a O(n) search instead of the efficient `.has_key?` 2. It clones all keys into separate array. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64975 --- qa/spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qa/spec/spec_helper.rb') diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb index 21bfd2876a9..363980acc33 100644 --- a/qa/spec/spec_helper.rb +++ b/qa/spec/spec_helper.rb @@ -46,7 +46,7 @@ RSpec.configure do |config| if ENV['CI'] config.around do |example| - retry_times = example.metadata.keys.include?(:quarantine) ? 1 : 2 + retry_times = example.metadata.key?(:quarantine) ? 1 : 2 example.run_with_retry retry: retry_times end end -- cgit v1.2.1