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
value = strip_value!(record, attribute, value)
Gitlab::UrlBlocker.validate!(value, blocker_args)
Gitlab::UrlBlocker.validate!(value, **blocker_args)
rescue Gitlab::UrlBlocker::BlockedUrlError => e
record.errors.add(attribute, options.fetch(:blocked_message) % { exception_message: e.message })
end
......
......@@ -16,7 +16,7 @@ module Gitlab
) do
include Gitlab::Utils::StrongMemoize
def initialize(**params)
def initialize(params = {})
params.each do |key, value|
self[key] = value
end
......
......@@ -36,9 +36,9 @@ module Gitlab
def self.fabricate(resource)
case resource
when Hash
self.new(resource.symbolize_keys)
self.new(**resource.symbolize_keys)
when ::Ci::HasVariable
self.new(resource.to_runner_variable)
self.new(**resource.to_runner_variable)
when self
resource.dup
else
......
......@@ -79,7 +79,7 @@ module Gitlab
end
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.parent = @attributes[:parent]
node.default = @attributes[:default]
......
......@@ -19,7 +19,7 @@ module Gitlab
entry = self.class.entry_class(strategy)
@subject = entry.new(config, metadata, &blk)
@subject = entry.new(config, **metadata, &blk)
super(@subject)
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