Commit 215228b4 authored by Douwe Maan's avatar Douwe Maan

Enable Performance/RedundantBlockCall

parent 8924594a
......@@ -923,6 +923,9 @@ Lint/UnneededSplatExpansion:
Lint/UnusedBlockArgument:
Enabled: false
Performance/RedundantBlockCall:
Enabled: true
Rails/HttpPositionalArguments:
Enabled: false
......
......@@ -6,14 +6,6 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 3
# Cop supports --auto-correct.
Performance/RedundantBlockCall:
Exclude:
- 'app/controllers/application_controller.rb'
- 'lib/gitlab/optimistic_locking.rb'
- 'lib/gitlab/shell.rb'
# Offense count: 5
# Cop supports --auto-correct.
Performance/RedundantMatch:
......
......@@ -181,7 +181,7 @@ class ApplicationController < ActionController::Base
end
def gitlab_ldap_access(&block)
Gitlab::LDAP::Access.open { |access| block.call(access) }
Gitlab::LDAP::Access.open { |access| yield(access) }
end
# JSON for infinite scroll via Pager object
......
......@@ -6,7 +6,7 @@ module Gitlab
loop do
begin
ActiveRecord::Base.transaction do
return block.call(subject)
return yield(subject)
end
rescue ActiveRecord::StaleObjectError
retries -= 1
......
......@@ -145,7 +145,7 @@ module Gitlab
# batch_add_keys { |adder| adder.add_key("key-42", "sha-rsa ...") }
def batch_add_keys(&block)
IO.popen(%W(#{gitlab_shell_path}/bin/gitlab-keys batch-add-keys), 'w') do |io|
block.call(KeyAdder.new(io))
yield(KeyAdder.new(io))
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