Skip to content

Enable Rubocop Performance/InefficientHashSearch

Stan Hu requested to merge sh-enable-rubocop-hash-search-ee 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.

CE port: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31117

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

Edited by Stan Hu

Merge request reports