Commit f54121ee authored by Igor Drozdov's avatar Igor Drozdov

Fix Ruby 2.7 deprecation warnings for ci/pipeline/chain

In Ruby 3.0, positional arguments and keyword arguments will be
separated. Ruby 2.7 will warn for behaviors that will change in Ruby
3.0. In most cases, you can avoid the incompatibility by adding the
double splat operator. It explicitly specifies passing keyword arguments
instead of a Hash object.
parent b928a9bd
...@@ -80,7 +80,7 @@ class AddressableUrlValidator < ActiveModel::EachValidator ...@@ -80,7 +80,7 @@ class AddressableUrlValidator < ActiveModel::EachValidator
value = strip_value!(record, attribute, value) value = strip_value!(record, attribute, value)
Gitlab::UrlBlocker.validate!(value, blocker_args) Gitlab::UrlBlocker.validate!(value, **blocker_args)
rescue Gitlab::UrlBlocker::BlockedUrlError => e rescue Gitlab::UrlBlocker::BlockedUrlError => e
record.errors.add(attribute, options.fetch(:blocked_message) % { exception_message: e.message }) record.errors.add(attribute, options.fetch(:blocked_message) % { exception_message: e.message })
end end
......
...@@ -16,7 +16,7 @@ module Gitlab ...@@ -16,7 +16,7 @@ module Gitlab
) do ) do
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
def initialize(**params) def initialize(params = {})
params.each do |key, value| params.each do |key, value|
self[key] = value self[key] = value
end end
......
...@@ -36,9 +36,9 @@ module Gitlab ...@@ -36,9 +36,9 @@ module Gitlab
def self.fabricate(resource) def self.fabricate(resource)
case resource case resource
when Hash when Hash
self.new(resource.symbolize_keys) self.new(**resource.symbolize_keys)
when ::Ci::HasVariable when ::Ci::HasVariable
self.new(resource.to_runner_variable) self.new(**resource.to_runner_variable)
when self when self
resource.dup resource.dup
else else
......
...@@ -79,7 +79,7 @@ module Gitlab ...@@ -79,7 +79,7 @@ module Gitlab
end end
def fabricate(entry_class, value = nil) def fabricate(entry_class, value = nil)
entry_class.new(value, @metadata) do |node| entry_class.new(value, **@metadata) do |node|
node.key = @attributes[:key] node.key = @attributes[:key]
node.parent = @attributes[:parent] node.parent = @attributes[:parent]
node.default = @attributes[:default] node.default = @attributes[:default]
......
...@@ -19,7 +19,7 @@ module Gitlab ...@@ -19,7 +19,7 @@ module Gitlab
entry = self.class.entry_class(strategy) entry = self.class.entry_class(strategy)
@subject = entry.new(config, metadata, &blk) @subject = entry.new(config, **metadata, &blk)
super(@subject) super(@subject)
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