Skip to content

Enable Rubocop Performance/InefficientHashSearch

Stan Hu requested to merge sh-enable-rubocop-hash-search into master

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.

EE port: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14828

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64975

Edited by Stan Hu

Merge request reports