Fix remaining cop offenses for Performance/OpenStruct
Problem
In https://gitlab.com/gitlab-org/gitlab-styles/-/merge_requests/82 and !55899 (merged) we've introduced a new Performance/OpenStruct and enabled it in !57257 (merged) to encourage the use of Struct.new(..., keyword_init: true) instead of OpenStruct.new(...).
This MR enabled the
Proposed solution
Replace use of OpenStruct in production code (spec are excluded) to use Struct or similar solutions instead.
- Pick a file from The List below e.g.
Guardfile - Create a branch (e.g.
rubocop-performance-openstruct-guardfile) - Delete the file from
.rubocop_manual_todo.yml - Check occurences with RuboCop via
bundle exec rubocop --auto-correct --only Performance/OpenStruct Guardfile - Convert the use of
OpenStruct.new(...)withStruct.new(..., keyword_init: true)or equivalent solution - Commit and create a merge request adding
Contributes to #325744and static code analysis label - Tick off the checkbox(es) and add the MR or mention this merge request in this issue
🎉
The list
-
Guardfile -
app/finders/snippets_finder.rb -
app/helpers/application_settings_helper.rb -
!59956 (merged) - app/models/cycle_analytics/project_level_stage_adapter.rb -
ee/lib/gitlab/graphql/aggregations/epics/epic_node.rb -
ee/lib/gitlab/graphql/aggregations/epics/epic_node.rb -
lib/api/wikis.rb -
!58430 (merged) - lib/gitlab/ci/ansi2html.rb -
!60086 (merged) - lib/gitlab/ci/reports/test_suite_comparer.rb -
lib/gitlab/git/diff_collection.rb -
lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb -
lib/gitlab/testing/request_inspector_middleware.rb -
lib/mattermost/session.rb
Edited by Peter Leitzen