Skip to content

Commit d6dab35

Browse files
committed
Suppress warning about keyword argument introduced from ruby 2.7
https://bugs.ruby-lang.org/issues/14183 Signed-off-by: Yuta Iwama <[email protected]>
1 parent 077508a commit d6dab35

File tree

9 files changed

+23
-19
lines changed

9 files changed

+23
-19
lines changed

lib/fluent/config/configure_proxy.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ def merge(other) # self is base class, other is subclass
117117

118118
merged = if self.root?
119119
options[:root] = true
120-
self.class.new(other.name, options)
120+
self.class.new(other.name, **options)
121121
else
122-
self.class.new(@name, options)
122+
self.class.new(@name, **options)
123123
end
124124

125125
# configured_in MUST be kept
@@ -172,9 +172,9 @@ def merge_for_finalized(other)
172172

173173
merged = if self.root?
174174
options[:root] = true
175-
self.class.new(other.name, options)
175+
self.class.new(other.name, **options)
176176
else
177-
self.class.new(@name, options)
177+
self.class.new(@name, **options)
178178
end
179179

180180
merged.configured_in_section = self.configured_in_section || other.configured_in_section

lib/fluent/plugin/buffer/chunk.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def open(**kwargs, &block)
202202
if kwargs[:compressed] == :gzip
203203
super
204204
else
205-
super(kwargs) do |chunk_io|
205+
super(**kwargs) do |chunk_io|
206206
output_io = if chunk_io.is_a?(StringIO)
207207
StringIO.new
208208
else

lib/fluent/plugin/formatter_csv.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def configure(conf)
5656
end
5757

5858
def format(tag, time, record)
59-
csv = (@cache[Thread.current] ||= CSV.new("".force_encoding(Encoding::ASCII_8BIT), @generate_opts))
59+
csv = (@cache[Thread.current] ||= CSV.new("".force_encoding(Encoding::ASCII_8BIT), **@generate_opts))
6060
line = (csv << record).string.dup
6161
# Need manual cleanup because CSV writer doesn't provide such method.
6262
csv.rewind
@@ -65,7 +65,7 @@ def format(tag, time, record)
6565
end
6666

6767
def format_with_nested_fields(tag, time, record)
68-
csv = (@cache[Thread.current] ||= CSV.new("".force_encoding(Encoding::ASCII_8BIT), @generate_opts))
68+
csv = (@cache[Thread.current] ||= CSV.new("".force_encoding(Encoding::ASCII_8BIT), **@generate_opts))
6969
values = @accessors.map { |a| a.call(record) }
7070
line = (csv << values).string.dup
7171
# Need manual cleanup because CSV writer doesn't provide such method.

lib/fluent/plugin_helper/child_process.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -267,19 +267,19 @@ def child_process_execute_once(
267267
end
268268

269269
if mode.include?(:write)
270-
writeio.set_encoding(external_encoding, internal_encoding, encoding_options)
270+
writeio.set_encoding(external_encoding, internal_encoding, **encoding_options)
271271
writeio_in_use = true
272272
else
273273
writeio.reopen(IO::NULL) if writeio
274274
end
275275
if mode.include?(:read) || mode.include?(:read_with_stderr)
276-
readio.set_encoding(external_encoding, internal_encoding, encoding_options)
276+
readio.set_encoding(external_encoding, internal_encoding, **encoding_options)
277277
readio_in_use = true
278278
else
279279
readio.reopen(IO::NULL) if readio
280280
end
281281
if mode.include?(:stderr)
282-
stderrio.set_encoding(external_encoding, internal_encoding, encoding_options)
282+
stderrio.set_encoding(external_encoding, internal_encoding, **encoding_options)
283283
stderrio_in_use = true
284284
else
285285
stderrio.reopen(IO::NULL) if stderrio && stderr == :discard

lib/fluent/plugin_helper/extract.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module ExtractParams
5555
config_param :time_type, :enum, list: [:float, :unixtime, :string], default: :float
5656

5757
Fluent::TimeMixin::TIME_PARAMETERS.each do |name, type, opts|
58-
config_param name, type, opts
58+
config_param(name, type, **opts)
5959
end
6060
end
6161
end

lib/fluent/plugin_helper/inject.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module InjectParams
7979
config_param :time_type, :enum, list: [:float, :unixtime, :string], default: :float
8080

8181
Fluent::TimeMixin::TIME_PARAMETERS.each do |name, type, opts|
82-
config_param name, type, opts
82+
config_param(name, type, **opts)
8383
end
8484
end
8585
end

lib/fluent/plugin_helper/server.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,9 @@ def write(data)
690690
end
691691

692692
if RUBY_VERSION.to_f >= 2.3
693-
NONBLOCK_ARG = {exception: false}
693+
NONBLOCK_ARG = { exception: false }
694694
def try_handshake
695-
@_handler_socket.accept_nonblock(NONBLOCK_ARG)
695+
@_handler_socket.accept_nonblock(**NONBLOCK_ARG)
696696
end
697697
else
698698
def try_handshake

lib/fluent/time.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ module TimeMixin
147147
module TimeParameters
148148
include Fluent::Configurable
149149
TIME_FULL_PARAMETERS.each do |name, type, opts|
150-
config_param name, type, opts
150+
config_param(name, type, **opts)
151151
end
152152

153153
def configure(conf)

test/counter/test_client.rb

+8-4
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ def travel(sec)
128128
test 'raise an error when @scope is nil' do
129129
@client.instance_variable_set(:@scope, nil)
130130
assert_raise 'Call `establish` method to get a `scope` before calling this method' do
131-
@client.init(name: 'key1', reset_interval: 10).get
131+
params = { name: 'key1', reset_interval: 10 }
132+
@client.init(params).get
132133
end
133134
end
134135

@@ -151,7 +152,8 @@ def travel(sec)
151152
]
152153
)
153154
test 'return an error object' do |(param, expected_error)|
154-
@client.init(:name => 'key1', :reset_interval => 10).get
155+
params = { name: 'key1', reset_interval: 10 }
156+
@client.init(params).get
155157
response = @client.init(param).get
156158
errors = response.errors.first
157159

@@ -164,7 +166,8 @@ def travel(sec)
164166
end
165167

166168
test 'return an existing value when passed key already exists and ignore option is true' do
167-
res1 = @client.init(name: 'key1', reset_interval: 10).get
169+
params = { name: 'key1', reset_interval: 10 }
170+
res1 = @client.init(params).get
168171
res2 = nil
169172
assert_nothing_raised do
170173
res2 = @client.init({ name: 'key1', reset_interval: 10 }, options: { ignore: true }).get
@@ -312,7 +315,8 @@ def travel(sec)
312315
test 'raise an error when @scope is nil' do
313316
@client.instance_variable_set(:@scope, nil)
314317
assert_raise 'Call `establish` method to get a `scope` before calling this method' do
315-
@client.inc(name: 'name', value: 1).get
318+
params = { name: 'name', value: 1 }
319+
@client.inc(params).get
316320
end
317321
end
318322

0 commit comments

Comments
 (0)