Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c45a1f06
Commit
c45a1f06
authored
Dec 04, 2021
by
Siddharth Asthana
Committed by
Peter Leitzen
Apr 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Style/OpenStructUse offenses by using `Struct`
Changelog: other
parent
86ddb91d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
.rubocop_todo/style/open_struct_use.yml
.rubocop_todo/style/open_struct_use.yml
+0
-1
app/helpers/application_settings_helper.rb
app/helpers/application_settings_helper.rb
+8
-2
No files found.
.rubocop_todo/style/open_struct_use.yml
View file @
c45a1f06
---
Style/OpenStructUse
:
Exclude
:
-
app/helpers/application_settings_helper.rb
-
ee/spec/features/projects/new_project_spec.rb
-
ee/spec/finders/template_finder_spec.rb
-
ee/spec/helpers/ee/blob_helper_spec.rb
...
...
app/helpers/application_settings_helper.rb
View file @
c45a1f06
...
...
@@ -37,9 +37,15 @@ module ApplicationSettingsHelper
end
def
storage_weights
Gitlab
.
config
.
repositories
.
storages
.
keys
.
each_with_object
(
OpenStruct
.
new
)
do
|
storage
,
weights
|
weights
[
storage
.
to_sym
]
=
@application_setting
.
repository_storages_weighted
[
storage
]
||
0
# Instead of using a `Struct` we could wrap this into an object.
# 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
weights
.
new
(
*
values
)
end
def
all_protocols_enabled?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment