Skip to content

Fix rubocop array literal in loop in spec/db/docs_spec.rb

Dylan Griffith requested to merge fix-rubocop-db-docs-spec-array-literal into master

What does this MR do and why?

Fix rubocop array literal in loop in spec/db/docs_spec.rb

This is causing a master broken in gitlab-org/quality/engineering-productivity/master-broken-incidents#4019 (closed)

See the failed job https://gitlab.com/gitlab-org/gitlab/-/jobs/5433189088 :

Offenses:
spec/db/docs_spec.rb:173:80: C: Performance/CollectionLiteralInLoop: Avoid immutable Array literals in loops. It is better to extract it into a local variable or a constant.
  database_base_models = Gitlab::Database.database_base_models.select { |k, _| %w[geo jh].exclude?(k) }
                                                                               ^^^^^^^^^^
spec/db/docs_spec.rb:182:80: C: Performance/CollectionLiteralInLoop: Avoid immutable Array literals in loops. It is better to extract it into a local variable or a constant.
  database_base_models = Gitlab::Database.database_base_models.select { |k, _| %w[geo jh].exclude?(k) }
                                                                               ^^^^^^^^^^
34087 files inspected, 2 offenses detected

This was merged in !133566 (merged) and must have somehow conflicted with a rubocop rule we were adding.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Dylan Griffith

Merge request reports