Project

General

Profile

Actions

Patch #32308

closed

Rubocop: Performance/RedundantBlockCall: Use yield instead of block.call.

Added by Marius BĂLTEANU over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Toshi MARUYAMA
Category:
Code cleanup/refactoring
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description


Offenses:

lib/redmine/scm/adapters/abstract_adapter.rb:252:17: C: [Corrected] Performance/RedundantBlockCall: Use yield instead of block.call.
                block.call(io) if block_given?
                ^^^^^^^^^^^^^^

Fix:

root@df2fd1389bf4:/work# git diff
diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb
index 67a1f17a3..14f8f09c4 100644
--- a/lib/redmine/scm/adapters/abstract_adapter.rb
+++ b/lib/redmine/scm/adapters/abstract_adapter.rb
@@ -249,7 +249,7 @@ module Redmine
               IO.popen(cmd, mode) do |io|
                 io.set_encoding("ASCII-8BIT") if io.respond_to?(:set_encoding)
                 io.close_write unless options[:write_stdin]
-                block.call(io) if block_given?
+                yield(io) if block_given?
               end
             rescue => e
               msg = strip_credential(e.message)


Files

yield.patch (3.63 KB) yield.patch Pavel Rosický, 2019-10-21 13:32
block_given.patch (365 Bytes) block_given.patch Pavel Rosický, 2019-10-21 13:35
Actions

Also available in: Atom PDF