Commit c45a1f06 authored by Siddharth Asthana's avatar Siddharth Asthana Committed by Peter Leitzen

Fix Style/OpenStructUse offenses by using `Struct`

Changelog: other
parent 86ddb91d
--- ---
Style/OpenStructUse: Style/OpenStructUse:
Exclude: Exclude:
- app/helpers/application_settings_helper.rb
- ee/spec/features/projects/new_project_spec.rb - ee/spec/features/projects/new_project_spec.rb
- ee/spec/finders/template_finder_spec.rb - ee/spec/finders/template_finder_spec.rb
- ee/spec/helpers/ee/blob_helper_spec.rb - ee/spec/helpers/ee/blob_helper_spec.rb
......
...@@ -37,9 +37,15 @@ module ApplicationSettingsHelper ...@@ -37,9 +37,15 @@ module ApplicationSettingsHelper
end end
def storage_weights def storage_weights
Gitlab.config.repositories.storages.keys.each_with_object(OpenStruct.new) do |storage, weights| # Instead of using a `Struct` we could wrap this into an object.
weights[storage.to_sym] = @application_setting.repository_storages_weighted[storage] || 0 # See https://gitlab.com/gitlab-org/gitlab/-/issues/358419
weights = Struct.new(*Gitlab.config.repositories.storages.keys.map(&:to_sym))
values = Gitlab.config.repositories.storages.keys.map do |storage|
@application_setting.repository_storages_weighted[storage] || 0
end end
weights.new(*values)
end end
def all_protocols_enabled? def all_protocols_enabled?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment