Commit 030baf70 authored by Douwe Maan's avatar Douwe Maan

Enable Performance/RedundantMerge

parent c5a49cc3
...@@ -889,6 +889,10 @@ Lint/Loop: ...@@ -889,6 +889,10 @@ Lint/Loop:
Metrics/BlockLength: Metrics/BlockLength:
Enabled: false Enabled: false
Performance/RedundantMerge:
Enabled: true
MaxKeyValuePairs: 1
RSpec/LetSetup: RSpec/LetSetup:
Enabled: false Enabled: false
......
...@@ -51,12 +51,6 @@ Performance/RedundantMatch: ...@@ -51,12 +51,6 @@ Performance/RedundantMatch:
- 'lib/gitlab/diff/highlight.rb' - 'lib/gitlab/diff/highlight.rb'
- 'lib/gitlab/diff/parser.rb' - 'lib/gitlab/diff/parser.rb'
# Offense count: 25
# Cop supports --auto-correct.
# Configuration parameters: MaxKeyValuePairs.
Performance/RedundantMerge:
Enabled: false
# Offense count: 15 # Offense count: 15
# Configuration parameters: CustomIncludeMethods. # Configuration parameters: CustomIncludeMethods.
RSpec/EmptyExampleGroup: RSpec/EmptyExampleGroup:
......
...@@ -30,7 +30,7 @@ module SortingHelper ...@@ -30,7 +30,7 @@ module SortingHelper
} }
if current_controller?('admin/projects') if current_controller?('admin/projects')
options.merge!(sort_value_largest_repo => sort_title_largest_repo) options[sort_value_largest_repo] = sort_title_largest_repo
end end
options options
......
...@@ -235,7 +235,7 @@ module Issuable ...@@ -235,7 +235,7 @@ module Issuable
# DEPRECATED # DEPRECATED
repository: project.hook_attrs.slice(:name, :url, :description, :homepage) repository: project.hook_attrs.slice(:name, :url, :description, :homepage)
} }
hook_data.merge!(assignee: assignee.hook_attrs) if assignee hook_data[:assignee] = assignee.hook_attrs if assignee
hook_data hook_data
end end
......
...@@ -527,7 +527,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -527,7 +527,7 @@ class MergeRequest < ActiveRecord::Base
} }
if diff_head_commit if diff_head_commit
attrs.merge!(last_commit: diff_head_commit.hook_attrs) attrs[:last_commit] = diff_head_commit.hook_attrs
end end
attributes.merge!(attrs) attributes.merge!(attrs)
......
...@@ -97,7 +97,7 @@ class PushoverService < Service ...@@ -97,7 +97,7 @@ class PushoverService < Service
# Sound parameter MUST NOT be sent to API if not selected # Sound parameter MUST NOT be sent to API if not selected
if sound if sound
pushover_data.merge!(sound: sound) pushover_data[:sound] = sound
end end
PushoverService.post('/messages.json', body: pushover_data) PushoverService.post('/messages.json', body: pushover_data)
......
...@@ -15,16 +15,16 @@ module ProtectedBranches ...@@ -15,16 +15,16 @@ module ProtectedBranches
case @developers_can_push case @developers_can_push
when true when true
params.merge!(push_access_levels_attributes: [{ access_level: Gitlab::Access::DEVELOPER }]) params[:push_access_levels_attributes] = [{ access_level: Gitlab::Access::DEVELOPER }]
when false when false
params.merge!(push_access_levels_attributes: [{ access_level: Gitlab::Access::MASTER }]) params[:push_access_levels_attributes] = [{ access_level: Gitlab::Access::MASTER }]
end end
case @developers_can_merge case @developers_can_merge
when true when true
params.merge!(merge_access_levels_attributes: [{ access_level: Gitlab::Access::DEVELOPER }]) params[:merge_access_levels_attributes] = [{ access_level: Gitlab::Access::DEVELOPER }]
when false when false
params.merge!(merge_access_levels_attributes: [{ access_level: Gitlab::Access::MASTER }]) params[:merge_access_levels_attributes] = [{ access_level: Gitlab::Access::MASTER }]
end end
service = ProtectedBranches::UpdateService.new(@project, @current_user, @params) service = ProtectedBranches::UpdateService.new(@project, @current_user, @params)
......
...@@ -33,9 +33,7 @@ class SystemHooksService ...@@ -33,9 +33,7 @@ class SystemHooksService
data.merge!(project_data(model)) data.merge!(project_data(model))
if event == :rename || event == :transfer if event == :rename || event == :transfer
data.merge!({ data[:old_path_with_namespace] = model.old_path_with_namespace
old_path_with_namespace: model.old_path_with_namespace
})
end end
data data
......
...@@ -359,7 +359,7 @@ module SystemNoteService ...@@ -359,7 +359,7 @@ module SystemNoteService
if noteable.kind_of?(Commit) if noteable.kind_of?(Commit)
note_options.merge!(noteable_type: 'Commit', commit_id: noteable.id) note_options.merge!(noteable_type: 'Commit', commit_id: noteable.id)
else else
note_options.merge!(noteable: noteable) note_options[:noteable] = noteable
end end
if noteable.is_a?(ExternalIssue) if noteable.is_a?(ExternalIssue)
......
...@@ -153,7 +153,7 @@ module SharedIssuable ...@@ -153,7 +153,7 @@ module SharedIssuable
case type case type
when :issue when :issue
attrs.merge!(project: project) attrs[:project] = project
when :merge_request when :merge_request
attrs.merge!( attrs.merge!(
source_project: project, source_project: project,
......
...@@ -172,7 +172,7 @@ module API ...@@ -172,7 +172,7 @@ module API
end end
end end
user_params.merge!(password_expires_at: Time.now) if user_params[:password].present? user_params[:password_expires_at] = Time.now if user_params[:password].present?
if user.update_attributes(user_params.except(:extern_uid, :provider)) if user.update_attributes(user_params.except(:extern_uid, :provider))
present user, with: Entities::UserPublic present user, with: Entities::UserPublic
......
...@@ -285,7 +285,7 @@ module Gitlab ...@@ -285,7 +285,7 @@ module Gitlab
def fetch_resources(resource_type, *opts) def fetch_resources(resource_type, *opts)
return if imported?(resource_type) return if imported?(resource_type)
opts.last.merge!(page: current_page(resource_type)) opts.last[:page] = current_page(resource_type)
client.public_send(resource_type, *opts) do |resources| client.public_send(resource_type, *opts) do |resources|
yield resources yield resources
......
...@@ -111,7 +111,7 @@ describe NotesFinder do ...@@ -111,7 +111,7 @@ describe NotesFinder do
end end
it 'raises an exception for an invalid target_type' do it 'raises an exception for an invalid target_type' do
params.merge!(target_type: 'invalid') params[:target_type] = 'invalid'
expect { described_class.new(project, user, params).execute }.to raise_error('invalid target_type') expect { described_class.new(project, user, params).execute }.to raise_error('invalid target_type')
end end
......
...@@ -50,7 +50,7 @@ describe Projects::CreateService, '#execute', services: true do ...@@ -50,7 +50,7 @@ describe Projects::CreateService, '#execute', services: true do
context 'error handling' do context 'error handling' do
it 'handles invalid options' do it 'handles invalid options' do
opts.merge!({ default_branch: 'master' } ) opts[:default_branch] = 'master'
expect(create_project(user, opts)).to eq(nil) expect(create_project(user, opts)).to eq(nil)
end end
end end
...@@ -67,7 +67,7 @@ describe Projects::CreateService, '#execute', services: true do ...@@ -67,7 +67,7 @@ describe Projects::CreateService, '#execute', services: true do
context 'wiki_enabled false does not create wiki repository directory' do context 'wiki_enabled false does not create wiki repository directory' do
it do it do
opts.merge!(wiki_enabled: false) opts[:wiki_enabled] = false
project = create_project(user, opts) project = create_project(user, opts)
path = ProjectWiki.new(project, user).send(:path_to_repo) path = ProjectWiki.new(project, user).send(:path_to_repo)
......
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