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

Enable Performance/RedundantMerge

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