Enable Performance/RedundantBlockCall

This commit is contained in:
Douwe Maan 2017-02-21 17:59:42 -06:00
parent 8924594a3e
commit 215228b477
5 changed files with 6 additions and 11 deletions

View file

@ -923,6 +923,9 @@ Lint/UnneededSplatExpansion:
Lint/UnusedBlockArgument:
Enabled: false
Performance/RedundantBlockCall:
Enabled: true
Rails/HttpPositionalArguments:
Enabled: false

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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