Commit 7e60aa18 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'ck3g-fix-kwargs-warnings-batch-4' into 'master'

Fix kwargs deprecation warnings for Ruby 2.7

See merge request gitlab-org/gitlab!49574
parents c6cdc324 328d90d1
......@@ -7,7 +7,7 @@ module API
def validate_param!(attr_name, params)
return if params.respond_to?(:key?) && !params.key?(attr_name)
raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message: message(:absence)
raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message(:absence))
end
end
end
......
......@@ -10,8 +10,10 @@ module API
return if value.is_a?(Array) ||
[IssuableFinder::Params::FILTER_NONE, IssuableFinder::Params::FILTER_ANY].include?(value.to_s.downcase)
raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)],
message: "should be an array, 'None' or 'Any'"
raise Grape::Exceptions::Validation.new(
params: [@scope.full_name(attr_name)],
message: "should be an array, 'None' or 'Any'"
)
end
end
end
......
......@@ -18,9 +18,10 @@ module API
def validate_param!(attr_name, params)
return if param_allowed?(attr_name, params)
raise Grape::Exceptions::Validation,
params: [@scope.full_name(attr_name)],
message: "allows one value, but found #{params[attr_name].size}: #{params[attr_name].join(", ")}"
raise Grape::Exceptions::Validation.new(
params: [@scope.full_name(attr_name)],
message: "allows one value, but found #{params[attr_name].size}: #{params[attr_name].join(", ")}"
)
end
private
......
......@@ -11,9 +11,10 @@ module API
return if value.split(',').map { |v| ValidateEmail.valid?(v) }.all?
raise Grape::Exceptions::Validation,
raise Grape::Exceptions::Validation.new(
params: [@scope.full_name(attr_name)],
message: "contains an invalid email address"
)
end
end
end
......
......@@ -11,8 +11,10 @@ module API
path = Gitlab::Utils.check_path_traversal!(path)
Gitlab::Utils.check_allowed_absolute_path!(path, path_allowlist)
rescue
raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)],
message: "should be a valid file path"
raise Grape::Exceptions::Validation.new(
params: [@scope.full_name(attr_name)],
message: "should be a valid file path"
)
end
end
end
......
......@@ -17,8 +17,10 @@ module API
return unless invalid_character?(revision)
raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)],
message: 'should be a valid reference path'
raise Grape::Exceptions::Validation.new(
params: [@scope.full_name(attr_name)],
message: 'should be a valid reference path'
)
end
private
......
......@@ -9,8 +9,10 @@ module API
return if Commit::EXACT_COMMIT_SHA_PATTERN.match?(sha)
raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)],
message: "should be a valid sha"
raise Grape::Exceptions::Validation.new(
params: [@scope.full_name(attr_name)],
message: "should be a valid sha"
)
end
end
end
......
......@@ -6,7 +6,7 @@ module API
class IntegerNoneAny < IntegerOrCustomValue
private
def extract_custom_values(options)
def extract_custom_values(_options)
[IssuableFinder::Params::FILTER_NONE, IssuableFinder::Params::FILTER_ANY]
end
end
......
......@@ -16,9 +16,10 @@ module API
return if @custom_values.map(&:downcase).include?(value.to_s.downcase)
valid_options = Gitlab::Utils.to_exclusive_sentence(['an integer'] + @custom_values)
raise Grape::Exceptions::Validation,
params: [@scope.full_name(attr_name)],
message: "should be #{valid_options}, however got #{value}"
raise Grape::Exceptions::Validation.new(
params: [@scope.full_name(attr_name)],
message: "should be #{valid_options}, however got #{value}"
)
end
private
......
......@@ -9,9 +9,10 @@ module API
return if value.size <= @option
raise Grape::Exceptions::Validation,
raise Grape::Exceptions::Validation.new(
params: [@scope.full_name(attr_name)],
message: "#{@scope.full_name(attr_name)} must be less than #{@option} characters"
)
end
end
end
......
......@@ -11,7 +11,7 @@ module API
Gitlab::UntrustedRegexp.new(value)
rescue RegexpError => e
message = "is an invalid regexp: #{e.message}"
raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message: message
raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message)
end
end
end
......
......@@ -31,7 +31,7 @@ module Gitlab
args = { cancelled: true }
args[:start] = start if timed
append_message(log_message + time_suffix_message(args))
append_message(log_message + time_suffix_message(**args))
raise TimeoutError
end
......
......@@ -22,8 +22,7 @@ module Gitlab
start_offset = @state.offset
@state.new_line!(
style: Style.new(@state.inherited_style))
@state.new_line!(style: Style.new(**@state.inherited_style))
stream.each_line do |line|
consume_line(line)
......
......@@ -45,7 +45,7 @@ module Gitlab
end
def add_attachments(reply)
attachments = Email::AttachmentUploader.new(mail).execute(upload_params)
attachments = Email::AttachmentUploader.new(mail).execute(**upload_params)
reply + attachments.map do |link|
"\n\n#{link[:markdown]}"
......
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