Commit e4ea312f authored by Vitali Tatarintev's avatar Vitali Tatarintev

Fix kwargs deprecation warnings for Ruby 2.7

Fixes warnings in:

* `app/graphql`
* `ee/app/graphql`
* `app/models`
* `app/services/git/base_hooks_service.rb`
* `app/services/ci/createpipeline_service.rb`
parent 27da16c9
...@@ -23,7 +23,10 @@ module Resolvers ...@@ -23,7 +23,10 @@ module Resolvers
def resolve(platform:, architecture:, **args) def resolve(platform:, architecture:, **args)
instructions = Gitlab::Ci::RunnerInstructions.new( instructions = Gitlab::Ci::RunnerInstructions.new(
{ current_user: current_user, os: platform, arch: architecture }.merge(target_param(args)) current_user: current_user,
os: platform,
arch: architecture,
**target_param(args)
) )
{ {
......
...@@ -304,14 +304,12 @@ module Issuable ...@@ -304,14 +304,12 @@ module Issuable
end end
def order_labels_priority(direction = 'ASC', excluded_labels: [], extra_select_columns: [], with_cte: false) def order_labels_priority(direction = 'ASC', excluded_labels: [], extra_select_columns: [], with_cte: false)
params = { highest_priority = highest_label_priority(
target_type: name, target_type: name,
target_column: "#{table_name}.id", target_column: "#{table_name}.id",
project_column: "#{table_name}.#{project_foreign_key}", project_column: "#{table_name}.#{project_foreign_key}",
excluded_labels: excluded_labels excluded_labels: excluded_labels
} ).to_sql
highest_priority = highest_label_priority(params).to_sql
# When using CTE make sure to select the same columns that are on the group_by clause. # When using CTE make sure to select the same columns that are on the group_by clause.
# This prevents errors when ignored columns are present in the database. # This prevents errors when ignored columns are present in the database.
......
...@@ -257,7 +257,7 @@ class Label < ApplicationRecord ...@@ -257,7 +257,7 @@ class Label < ApplicationRecord
end end
def present(attributes) def present(attributes)
super(attributes.merge(presenter_class: ::LabelPresenter)) super(**attributes.merge(presenter_class: ::LabelPresenter))
end end
private private
......
...@@ -139,13 +139,11 @@ class Todo < ApplicationRecord ...@@ -139,13 +139,11 @@ class Todo < ApplicationRecord
# Todos with highest priority first then oldest todos # Todos with highest priority first then oldest todos
# Need to order by created_at last because of differences on Mysql and Postgres when joining by type "Merge_request/Issue" # Need to order by created_at last because of differences on Mysql and Postgres when joining by type "Merge_request/Issue"
def order_by_labels_priority def order_by_labels_priority
params = { highest_priority = highest_label_priority(
target_type_column: "todos.target_type", target_type_column: "todos.target_type",
target_column: "todos.target_id", target_column: "todos.target_id",
project_column: "todos.project_id" project_column: "todos.project_id"
} ).to_sql
highest_priority = highest_label_priority(params).to_sql
select("#{table_name}.*, (#{highest_priority}) AS highest_priority") select("#{table_name}.*, (#{highest_priority}) AS highest_priority")
.order(Gitlab::Database.nulls_last_order('highest_priority', 'ASC')) .order(Gitlab::Database.nulls_last_order('highest_priority', 'ASC'))
......
...@@ -91,7 +91,9 @@ module Ci ...@@ -91,7 +91,9 @@ module Ci
# rubocop: enable Metrics/ParameterLists # rubocop: enable Metrics/ParameterLists
def execute!(*args, &block) def execute!(*args, &block)
execute(*args, &block).tap do |pipeline| source, params = args[0], Hash(args[1])
execute(source, **params, &block).tap do |pipeline|
unless pipeline.persisted? unless pipeline.persisted?
raise CreateError, pipeline.full_error_messages raise CreateError, pipeline.full_error_messages
end end
......
...@@ -135,11 +135,12 @@ module Git ...@@ -135,11 +135,12 @@ module Git
# We only need the last commit for the event push, and we don't # We only need the last commit for the event push, and we don't
# need the full deltas either. # need the full deltas either.
@event_push_data ||= Gitlab::DataBuilder::Push.build( @event_push_data ||= Gitlab::DataBuilder::Push.build(
push_data_params(commits: commits.last, with_changed_files: false)) **push_data_params(commits: commits.last, with_changed_files: false)
)
end end
def push_data def push_data
@push_data ||= Gitlab::DataBuilder::Push.build(push_data_params(commits: limited_commits)) @push_data ||= Gitlab::DataBuilder::Push.build(**push_data_params(commits: limited_commits))
# Dependent code may modify the push data, so return a duplicate each time # Dependent code may modify the push data, so return a duplicate each time
@push_data.dup @push_data.dup
......
...@@ -52,7 +52,7 @@ module Resolvers ...@@ -52,7 +52,7 @@ module Resolvers
validate_timeframe_params!(args) validate_timeframe_params!(args)
validate_starts_with_iid!(args) validate_starts_with_iid!(args)
super(args) super(**args)
end end
def resolve_with_lookahead(**args) def resolve_with_lookahead(**args)
......
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