Commit b399a354 authored by Vitali Tatarintev's avatar Vitali Tatarintev Committed by Peter Leitzen

Fix Style/EachWithObject offenses

Fixes Style/EachWithObject offenses
parent eb2022fe
...@@ -309,16 +309,6 @@ Style/BarePercentLiterals: ...@@ -309,16 +309,6 @@ Style/BarePercentLiterals:
Style/CaseLikeIf: Style/CaseLikeIf:
Enabled: false Enabled: false
# Offense count: 5
# Cop supports --auto-correct.
Style/EachWithObject:
Exclude:
- 'lib/expand_variables.rb'
- 'lib/gitlab/ci/ansi2html.rb'
- 'lib/gitlab/hook_data/issuable_builder.rb'
- 'lib/gitlab/i18n/po_linter.rb'
- 'lib/gitlab/import_export/members_mapper.rb'
# Offense count: 55 # Offense count: 55
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle. # Configuration parameters: EnforcedStyle.
......
...@@ -50,9 +50,8 @@ module ExpandVariables ...@@ -50,9 +50,8 @@ module ExpandVariables
# Convert hash array to variables # Convert hash array to variables
if variables.is_a?(Array) if variables.is_a?(Array)
variables = variables.reduce({}) do |hash, variable| variables = variables.each_with_object({}) do |variable, hash|
hash[variable[:key]] = variable[:value] hash[variable[:key]] = variable[:value]
hash
end end
end end
......
...@@ -447,9 +447,8 @@ module Gitlab ...@@ -447,9 +447,8 @@ module Gitlab
end end
def state def state
state = STATE_PARAMS.inject({}) do |h, param| state = STATE_PARAMS.each_with_object({}) do |param, h|
h[param] = send(param) # rubocop:disable GitlabSecurity/PublicSend h[param] = send(param) # rubocop:disable GitlabSecurity/PublicSend
h
end end
Base64.urlsafe_encode64(state.to_json) Base64.urlsafe_encode64(state.to_json)
end end
......
...@@ -53,10 +53,7 @@ module Gitlab ...@@ -53,10 +53,7 @@ module Gitlab
end end
def final_changes(changes_hash) def final_changes(changes_hash)
changes_hash.reduce({}) do |hash, (key, changes_array)| changes_hash.transform_values { |changes_array| Hash[CHANGES_KEYS.zip(changes_array)] }
hash[key] = Hash[CHANGES_KEYS.zip(changes_array)]
hash
end
end end
end end
end end
......
...@@ -248,10 +248,9 @@ module Gitlab ...@@ -248,10 +248,9 @@ module Gitlab
variable == '%d' ? Random.rand(1000) : Gitlab::Utils.random_string variable == '%d' ? Random.rand(1000) : Gitlab::Utils.random_string
end end
else else
variables.inject({}) do |hash, variable| variables.each_with_object({}) do |variable, hash|
variable_name = variable[/\w+/] variable_name = variable[/\w+/]
hash[variable_name] = Gitlab::Utils.random_string hash[variable_name] = Gitlab::Utils.random_string
hash
end end
end end
end end
......
...@@ -16,7 +16,7 @@ module Gitlab ...@@ -16,7 +16,7 @@ module Gitlab
def map def map
@map ||= @map ||=
begin begin
@exported_members.inject(missing_keys_tracking_hash) do |hash, member| @exported_members.each_with_object(missing_keys_tracking_hash) do |member, hash|
if member['user'] if member['user']
old_user_id = member['user']['id'] old_user_id = member['user']['id']
existing_user_id = existing_users_email_map[get_email(member)] existing_user_id = existing_users_email_map[get_email(member)]
...@@ -24,8 +24,6 @@ module Gitlab ...@@ -24,8 +24,6 @@ module Gitlab
else else
add_team_member(member) add_team_member(member)
end end
hash
end end
end end
end end
......
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