summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-01-11 13:20:52 +0000
committerGo MAEDA <maeda@farend.jp>2023-01-11 13:20:52 +0000
commit3942177f49002d50aa65f803be85167d845675dd (patch)
tree42fae6f20931876145545c007cb21ddd98ee71cc /lib
parent3eb364e45ae11c681677d7b9e3fd13f88d5b1d6b (diff)
downloadredmine-3942177f49002d50aa65f803be85167d845675dd.tar.gz
redmine-3942177f49002d50aa65f803be85167d845675dd.zip
Fix RuboCop offense Performance/BlockGivenWithExplicitBlock (#38146).
git-svn-id: https://svn.redmine.org/redmine/trunk@22027 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/scm/adapters/abstract_adapter.rb2
-rw-r--r--lib/redmine/views/builders.rb2
-rw-r--r--lib/redmine/views/builders/structure.rb4
-rw-r--r--lib/redmine/wiki_formatting/macros.rb4
4 files changed, 6 insertions, 6 deletions
diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb
index fd123c598..7d211ad4f 100644
--- a/lib/redmine/scm/adapters/abstract_adapter.rb
+++ b/lib/redmine/scm/adapters/abstract_adapter.rb
@@ -267,7 +267,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]
- yield(io) if block_given?
+ yield(io) if block
end
rescue => e
msg = strip_credential(e.message)
diff --git a/lib/redmine/views/builders.rb b/lib/redmine/views/builders.rb
index dda689edc..b8ea9175c 100644
--- a/lib/redmine/views/builders.rb
+++ b/lib/redmine/views/builders.rb
@@ -34,7 +34,7 @@ module Redmine
response.status = 406
return "We couldn't handle your request, sorry. If you were trying to access the API, make sure to append .json or .xml to your request URL.\n"
end
- if block_given?
+ if block
yield(builder)
else
builder
diff --git a/lib/redmine/views/builders/structure.rb b/lib/redmine/views/builders/structure.rb
index c94896117..bfcb6dc62 100644
--- a/lib/redmine/views/builders/structure.rb
+++ b/lib/redmine/views/builders/structure.rb
@@ -58,7 +58,7 @@ module Redmine
else
value = encode_value(args.first)
if @struct.last.is_a?(Array)
- if args.size == 1 && !block_given?
+ if args.size == 1 && !block
@struct.last << value
else
@struct.last << (args.last || {}).merge(:value => value)
@@ -68,7 +68,7 @@ module Redmine
end
end
end
- if block_given?
+ if block
@struct << (args.first.is_a?(Hash) ? args.first : {})
yield(self)
ret = @struct.pop
diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb
index 61218d93a..a2acd07eb 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -84,7 +84,7 @@ module Redmine
# end
# end
def register(&block)
- class_eval(&block) if block_given?
+ class_eval(&block) if block
end
# Defines a new macro with the given name, options and block.
@@ -154,7 +154,7 @@ module Redmine
unless /\A\w+\z/.match?(name.to_s)
raise "Invalid macro name: #{name} (only 0-9, A-Z, a-z and _ characters are accepted)"
end
- unless block_given?
+ unless block
raise "Can not create a macro without a block!"
end