Commit 06571e03 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'pl-rubocop-todo-parallel-assignment' into 'master'

Resolves rubocop offense Style/ParallelAssignment

See merge request gitlab-org/gitlab!57999
parents 7f333beb b62ce98c
...@@ -845,11 +845,6 @@ Style/Next: ...@@ -845,11 +845,6 @@ Style/Next:
Style/NumericLiteralPrefix: Style/NumericLiteralPrefix:
Enabled: false Enabled: false
# Offense count: 140
# Cop supports --auto-correct.
Style/ParallelAssignment:
Enabled: false
# Offense count: 2698 # Offense count: 2698
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters. # Configuration parameters: PreferredDelimiters.
......
...@@ -308,7 +308,8 @@ class Clusters::ClustersController < Clusters::BaseController ...@@ -308,7 +308,8 @@ class Clusters::ClustersController < Clusters::BaseController
def proxy_variable_substitution_service def proxy_variable_substitution_service
@empty_service ||= Class.new(BaseService) do @empty_service ||= Class.new(BaseService) do
def initialize(proxyable, params) def initialize(proxyable, params)
@proxyable, @params = proxyable, params @proxyable = proxyable
@params = params
end end
def execute def execute
......
...@@ -63,7 +63,8 @@ class Projects::CommitsController < Projects::ApplicationController ...@@ -63,7 +63,8 @@ class Projects::CommitsController < Projects::ApplicationController
def set_commits def set_commits
render_404 unless @path.empty? || request.format == :atom || @repository.blob_at(@commit.id, @path) || @repository.tree(@commit.id, @path).entries.present? render_404 unless @path.empty? || request.format == :atom || @repository.blob_at(@commit.id, @path) || @repository.tree(@commit.id, @path).entries.present?
@limit, @offset = (params[:limit] || 40).to_i, (params[:offset] || 0).to_i @limit = (params[:limit] || 40).to_i
@offset = (params[:offset] || 0).to_i
search = params[:search] search = params[:search]
author = params[:author] author = params[:author]
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
module Ci module Ci
class VariablesFinder class VariablesFinder
def initialize(resource, params) def initialize(resource, params)
@resource, @params = resource, params @resource = resource
@params = params
raise ArgumentError, 'Please provide params[:key]' if params[:key].blank? raise ArgumentError, 'Please provide params[:key]' if params[:key].blank?
end end
......
...@@ -4,7 +4,9 @@ class EnvironmentsByDeploymentsFinder ...@@ -4,7 +4,9 @@ class EnvironmentsByDeploymentsFinder
attr_reader :project, :current_user, :params attr_reader :project, :current_user, :params
def initialize(project, current_user, params = {}) def initialize(project, current_user, params = {})
@project, @current_user, @params = project, current_user, params @project = project
@current_user = current_user
@params = params
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
......
...@@ -6,7 +6,9 @@ class EnvironmentsFinder ...@@ -6,7 +6,9 @@ class EnvironmentsFinder
InvalidStatesError = Class.new(StandardError) InvalidStatesError = Class.new(StandardError)
def initialize(project, current_user, params = {}) def initialize(project, current_user, params = {})
@project, @current_user, @params = project, current_user, params @project = project
@current_user = current_user
@params = params
end end
def execute def execute
......
...@@ -4,7 +4,8 @@ module Metrics ...@@ -4,7 +4,8 @@ module Metrics
module Dashboards module Dashboards
class AnnotationsFinder class AnnotationsFinder
def initialize(dashboard:, params:) def initialize(dashboard:, params:)
@dashboard, @params = dashboard, params @dashboard = dashboard
@params = params
end end
def execute def execute
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
module Metrics module Metrics
class UsersStarredDashboardsFinder class UsersStarredDashboardsFinder
def initialize(user:, project:, params: {}) def initialize(user:, project:, params: {})
@user, @project, @params = user, project, params @user = user
@project = project
@params = params
end end
def execute def execute
......
...@@ -4,7 +4,8 @@ module Packages ...@@ -4,7 +4,8 @@ module Packages
module Debian module Debian
class DistributionsFinder class DistributionsFinder
def initialize(container, params = {}) def initialize(container, params = {})
@container, @params = container, params @container = container
@params = params
end end
def execute def execute
......
...@@ -18,7 +18,8 @@ module SubmoduleHelper ...@@ -18,7 +18,8 @@ module SubmoduleHelper
end end
if url =~ %r{([^/:]+)/([^/]+(?:\.git)?)\Z} if url =~ %r{([^/:]+)/([^/]+(?:\.git)?)\Z}
namespace, project = Regexp.last_match(1), Regexp.last_match(2) namespace = Regexp.last_match(1)
project = Regexp.last_match(2)
gitlab_hosts = [Gitlab.config.gitlab.url, gitlab_hosts = [Gitlab.config.gitlab.url,
Gitlab.config.gitlab_shell.ssh_path_prefix] Gitlab.config.gitlab_shell.ssh_path_prefix]
......
...@@ -58,7 +58,8 @@ class Ability ...@@ -58,7 +58,8 @@ class Ability
def allowed?(user, action, subject = :global, opts = {}) def allowed?(user, action, subject = :global, opts = {})
if subject.is_a?(Hash) if subject.is_a?(Hash)
opts, subject = subject, :global opts = subject
subject = :global
end end
policy = policy_for(user, subject) policy = policy_for(user, subject)
......
...@@ -438,11 +438,14 @@ module ApplicationSettingImplementation ...@@ -438,11 +438,14 @@ module ApplicationSettingImplementation
def parse_addr_and_port(str) def parse_addr_and_port(str)
case str case str
when /\A\[(?<address> .* )\]:(?<port> \d+ )\z/x # string like "[::1]:80" when /\A\[(?<address> .* )\]:(?<port> \d+ )\z/x # string like "[::1]:80"
address, port = $~[:address], $~[:port] address = $~[:address]
port = $~[:port]
when /\A(?<address> [^:]+ ):(?<port> \d+ )\z/x # string like "127.0.0.1:80" when /\A(?<address> [^:]+ ):(?<port> \d+ )\z/x # string like "127.0.0.1:80"
address, port = $~[:address], $~[:port] address = $~[:address]
port = $~[:port]
else # string with no port number else # string with no port number
address, port = str, nil address = str
port = nil
end end
[address, port&.to_i] [address, port&.to_i]
......
...@@ -62,7 +62,8 @@ class Commit ...@@ -62,7 +62,8 @@ class Commit
collection.sort do |a, b| collection.sort do |a, b|
operands = [a, b].tap { |o| o.reverse! if sort == 'desc' } operands = [a, b].tap { |o| o.reverse! if sort == 'desc' }
attr1, attr2 = operands.first.public_send(order_by), operands.second.public_send(order_by) # rubocop:disable GitlabSecurity/PublicSend attr1 = operands.first.public_send(order_by) # rubocop:disable GitlabSecurity/PublicSend
attr2 = operands.second.public_send(order_by) # rubocop:disable GitlabSecurity/PublicSend
# use case insensitive comparison for string values # use case insensitive comparison for string values
order_by.in?(%w[email name]) ? attr1.casecmp(attr2) : attr1 <=> attr2 order_by.in?(%w[email name]) ? attr1.casecmp(attr2) : attr1 <=> attr2
......
...@@ -30,7 +30,8 @@ module Taskable ...@@ -30,7 +30,8 @@ module Taskable
end end
def self.get_updated_tasks(old_content:, new_content:) def self.get_updated_tasks(old_content:, new_content:)
old_tasks, new_tasks = get_tasks(old_content), get_tasks(new_content) old_tasks = get_tasks(old_content)
new_tasks = get_tasks(new_content)
new_tasks.select.with_index do |new_task, i| new_tasks.select.with_index do |new_task, i|
old_task = old_tasks[i] old_task = old_tasks[i]
......
...@@ -29,7 +29,9 @@ module DesignManagement ...@@ -29,7 +29,9 @@ module DesignManagement
# - design [DesignManagement::Design]: the design that was changed # - design [DesignManagement::Design]: the design that was changed
# - action [Symbol]: the action that gitaly performed # - action [Symbol]: the action that gitaly performed
def initialize(design, action, content = nil) def initialize(design, action, content = nil)
@design, @action, @content = design, action, content @design = design
@action = action
@content = content
validate! validate!
end end
......
...@@ -18,7 +18,8 @@ module DesignManagement ...@@ -18,7 +18,8 @@ module DesignManagement
validate :design_and_version_have_issue_id validate :design_and_version_have_issue_id
def initialize(design: nil, version: nil) def initialize(design: nil, version: nil)
@design, @version = design, version @design = design
@version = version
end end
# The ID, needed by GraphQL types and as part of the Lazy-fetch # The ID, needed by GraphQL types and as part of the Lazy-fetch
......
...@@ -14,7 +14,9 @@ module DesignManagement ...@@ -14,7 +14,9 @@ module DesignManagement
attr_reader :sha, :issue_id, :actions attr_reader :sha, :issue_id, :actions
def initialize(sha, issue_id, actions) def initialize(sha, issue_id, actions)
@sha, @issue_id, @actions = sha, issue_id, actions @sha = sha
@issue_id = issue_id
@actions = actions
end end
def message def message
......
...@@ -6,7 +6,8 @@ class ExternalIssue ...@@ -6,7 +6,8 @@ class ExternalIssue
attr_reader :project attr_reader :project
def initialize(issue_identifier, project) def initialize(issue_identifier, project)
@issue_identifier, @project = issue_identifier, project @issue_identifier = issue_identifier
@project = project
end end
def to_s def to_s
......
...@@ -291,7 +291,9 @@ class Member < ApplicationRecord ...@@ -291,7 +291,9 @@ class Member < ApplicationRecord
private private
def parse_users_list(source, list) def parse_users_list(source, list)
emails, user_ids, users = [], [], [] emails = []
user_ids = []
users = []
existing_members = {} existing_members = {}
list.each do |item| list.each do |item|
......
...@@ -13,7 +13,9 @@ module Preloaders ...@@ -13,7 +13,9 @@ module Preloaders
attr_reader :labels, :user, :project attr_reader :labels, :user, :project
def initialize(labels, user, project = nil) def initialize(labels, user, project = nil)
@labels, @user, @project = labels, user, project @labels = labels
@user = user
@project = project
end end
def preload_all def preload_all
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
module ApplicationSettings module ApplicationSettings
class BaseService < ::BaseService class BaseService < ::BaseService
def initialize(application_setting, user, params = {}) def initialize(application_setting, user, params = {})
@application_setting, @current_user, @params = application_setting, user, params.dup @application_setting = application_setting
@current_user = user
@params = params.dup
end end
end end
end end
...@@ -7,6 +7,8 @@ class BaseContainerService ...@@ -7,6 +7,8 @@ class BaseContainerService
attr_reader :container, :current_user, :params attr_reader :container, :current_user, :params
def initialize(container:, current_user: nil, params: {}) def initialize(container:, current_user: nil, params: {})
@container, @current_user, @params = container, current_user, params.dup @container = container
@current_user = current_user
@params = params.dup
end end
end end
...@@ -15,7 +15,9 @@ class BaseService ...@@ -15,7 +15,9 @@ class BaseService
attr_accessor :project, :current_user, :params attr_accessor :project, :current_user, :params
def initialize(project, user = nil, params = {}) def initialize(project, user = nil, params = {})
@project, @current_user, @params = project, user, params.dup @project = project
@current_user = user
@params = params.dup
end end
delegate :repository, to: :project delegate :repository, to: :project
......
...@@ -6,7 +6,9 @@ module Boards ...@@ -6,7 +6,9 @@ module Boards
attr_accessor :parent, :current_user, :params attr_accessor :parent, :current_user, :params
def initialize(parent, user, params = {}) def initialize(parent, user, params = {})
@parent, @current_user, @params = parent, user, params.dup @parent = parent
@current_user = user
@params = params.dup
end end
end end
end end
......
...@@ -96,7 +96,8 @@ module Ci ...@@ -96,7 +96,8 @@ module Ci
# rubocop: enable Metrics/ParameterLists # rubocop: enable Metrics/ParameterLists
def execute!(*args, &block) def execute!(*args, &block)
source, params = args[0], Hash(args[1]) source = args[0]
params = Hash(args[1])
execute(source, **params, &block).tap do |pipeline| execute(source, **params, &block).tap do |pipeline|
unless pipeline.persisted? unless pipeline.persisted?
......
...@@ -5,7 +5,8 @@ module Clusters ...@@ -5,7 +5,8 @@ module Clusters
attr_reader :current_user, :params attr_reader :current_user, :params
def initialize(user = nil, params = {}) def initialize(user = nil, params = {})
@current_user, @params = user, params.dup @current_user = user
@params = params.dup
end end
def execute(access_token: nil) def execute(access_token: nil)
......
...@@ -5,7 +5,8 @@ module Clusters ...@@ -5,7 +5,8 @@ module Clusters
attr_reader :current_user, :params attr_reader :current_user, :params
def initialize(user = nil, params = {}) def initialize(user = nil, params = {})
@current_user, @params = user, params.dup @current_user = user
@params = params.dup
@response = {} @response = {}
end end
......
...@@ -5,7 +5,8 @@ module Clusters ...@@ -5,7 +5,8 @@ module Clusters
attr_reader :current_user, :params attr_reader :current_user, :params
def initialize(user = nil, params = {}) def initialize(user = nil, params = {})
@current_user, @params = user, params.dup @current_user = user
@params = params.dup
end end
def execute(cluster) def execute(cluster)
......
...@@ -5,7 +5,9 @@ module DraftNotes ...@@ -5,7 +5,9 @@ module DraftNotes
attr_accessor :merge_request, :current_user, :params attr_accessor :merge_request, :current_user, :params
def initialize(merge_request, current_user, params = nil) def initialize(merge_request, current_user, params = nil)
@merge_request, @current_user, @params = merge_request, current_user, params.dup @merge_request = merge_request
@current_user = current_user
@params = params.dup
end end
def merge_request_activity_counter def merge_request_activity_counter
......
...@@ -8,7 +8,9 @@ module Git ...@@ -8,7 +8,9 @@ module Git
attr_reader :wiki attr_reader :wiki
def initialize(wiki, current_user, params) def initialize(wiki, current_user, params)
@wiki, @current_user, @params = wiki, current_user, params.dup @wiki = wiki
@current_user = current_user
@params = params.dup
end end
def execute def execute
......
...@@ -9,7 +9,9 @@ module Git ...@@ -9,7 +9,9 @@ module Git
# @param [Hash] change - must have keys `:oldrev` and `:newrev` # @param [Hash] change - must have keys `:oldrev` and `:newrev`
# @param [Gitlab::Git::RawDiffChange] raw_change # @param [Gitlab::Git::RawDiffChange] raw_change
def initialize(wiki, change, raw_change) def initialize(wiki, change, raw_change)
@wiki, @raw_change, @change = wiki, raw_change, change @wiki = wiki
@raw_change = raw_change
@change = change
end end
def page def page
......
...@@ -5,7 +5,9 @@ module Groups ...@@ -5,7 +5,9 @@ module Groups
attr_accessor :group, :current_user, :params attr_accessor :group, :current_user, :params
def initialize(group, user, params = {}) def initialize(group, user, params = {})
@group, @current_user, @params = group, user, params.dup @group = group
@current_user = user
@params = params.dup
end end
private private
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
module Groups module Groups
class CreateService < Groups::BaseService class CreateService < Groups::BaseService
def initialize(user, params = {}) def initialize(user, params = {})
@current_user, @params = user, params.dup @current_user = user
@params = params.dup
@chat_team = @params.delete(:create_chat_team) @chat_team = @params.delete(:create_chat_team)
end end
......
...@@ -5,7 +5,8 @@ module Groups ...@@ -5,7 +5,8 @@ module Groups
attr_reader :group_path, :visibility_level attr_reader :group_path, :visibility_level
def initialize(user, params) def initialize(user, params)
@current_user, @params = user, params.dup @current_user = user
@params = params.dup
@group_path = @params.delete(:group_path) @group_path = @params.delete(:group_path)
@visibility_level = @params.delete(:visibility_level) || @visibility_level = @params.delete(:visibility_level) ||
Gitlab::CurrentSettings.current_application_settings.default_group_visibility Gitlab::CurrentSettings.current_application_settings.default_group_visibility
......
...@@ -7,7 +7,9 @@ module Issuable ...@@ -7,7 +7,9 @@ module Issuable
attr_accessor :parent, :current_user, :params attr_accessor :parent, :current_user, :params
def initialize(parent, user = nil, params = {}) def initialize(parent, user = nil, params = {})
@parent, @current_user, @params = parent, user, params.dup @parent = parent
@current_user = user
@params = params.dup
end end
def execute(type) def execute(type)
......
...@@ -7,7 +7,9 @@ module IssuableLinks ...@@ -7,7 +7,9 @@ module IssuableLinks
attr_reader :issuable, :current_user, :params attr_reader :issuable, :current_user, :params
def initialize(issuable, user, params) def initialize(issuable, user, params)
@issuable, @current_user, @params = issuable, user, params.dup @issuable = issuable
@current_user = user
@params = params.dup
end end
def execute def execute
......
...@@ -7,7 +7,8 @@ module IssuableLinks ...@@ -7,7 +7,8 @@ module IssuableLinks
attr_reader :issuable, :current_user attr_reader :issuable, :current_user
def initialize(issuable, user) def initialize(issuable, user)
@issuable, @current_user = issuable, user @issuable = issuable
@current_user = user
end end
def execute def execute
......
...@@ -5,7 +5,9 @@ module JiraConnectSubscriptions ...@@ -5,7 +5,9 @@ module JiraConnectSubscriptions
attr_accessor :jira_connect_installation, :current_user, :params attr_accessor :jira_connect_installation, :current_user, :params
def initialize(jira_connect_installation, user = nil, params = {}) def initialize(jira_connect_installation, user = nil, params = {})
@jira_connect_installation, @current_user, @params = jira_connect_installation, user, params.dup @jira_connect_installation = jira_connect_installation
@current_user = user
@params = params.dup
end end
end end
end end
...@@ -5,7 +5,8 @@ module Keys ...@@ -5,7 +5,8 @@ module Keys
attr_accessor :user, :params attr_accessor :user, :params
def initialize(user, params = {}) def initialize(user, params = {})
@user, @params = user, params @user = user
@params = params
@ip_address = @params.delete(:ip_address) @ip_address = @params.delete(:ip_address)
end end
......
...@@ -5,7 +5,8 @@ module Keys ...@@ -5,7 +5,8 @@ module Keys
attr_accessor :current_user attr_accessor :current_user
def initialize(current_user, params = {}) def initialize(current_user, params = {})
@current_user, @params = current_user, params @current_user = current_user
@params = params
@ip_address = @params.delete(:ip_address) @ip_address = @params.delete(:ip_address)
@user = params.delete(:user) || current_user @user = params.delete(:user) || current_user
end end
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
module Mattermost module Mattermost
class CreateTeamService < ::BaseService class CreateTeamService < ::BaseService
def initialize(group, current_user) def initialize(group, current_user)
@group, @current_user = group, current_user @group = group
@current_user = current_user
end end
def execute def execute
......
...@@ -13,7 +13,8 @@ module Metrics ...@@ -13,7 +13,8 @@ module Metrics
:create :create
def initialize(user, params) def initialize(user, params)
@user, @params = user, params @user = user
@params = params
end end
def execute def execute
......
...@@ -11,7 +11,8 @@ module Metrics ...@@ -11,7 +11,8 @@ module Metrics
:delete :delete
def initialize(user, annotation) def initialize(user, annotation)
@user, @annotation = user, annotation @user = user
@annotation = annotation
end end
def execute def execute
......
...@@ -122,7 +122,8 @@ module Metrics ...@@ -122,7 +122,8 @@ module Metrics
# Identifies the uid of the dashboard based on url format # Identifies the uid of the dashboard based on url format
class GrafanaUidParser class GrafanaUidParser
def initialize(grafana_url, project) def initialize(grafana_url, project)
@grafana_url, @project = grafana_url, project @grafana_url = grafana_url
@project = project
end end
def parse def parse
...@@ -145,7 +146,8 @@ module Metrics ...@@ -145,7 +146,8 @@ module Metrics
# If no panel is specified, defaults to the first valid panel. # If no panel is specified, defaults to the first valid panel.
class DatasourceNameParser class DatasourceNameParser
def initialize(grafana_url, grafana_dashboard) def initialize(grafana_url, grafana_dashboard)
@grafana_url, @grafana_dashboard = grafana_url, grafana_dashboard @grafana_url = grafana_url
@grafana_dashboard = grafana_dashboard
end end
def parse def parse
......
...@@ -22,7 +22,9 @@ module Metrics ...@@ -22,7 +22,9 @@ module Metrics
].freeze ].freeze
def initialize(project, panel_yaml, environment) def initialize(project, panel_yaml, environment)
@project, @panel_yaml, @environment = project, panel_yaml, environment @project = project
@panel_yaml = panel_yaml
@environment = environment
end end
def execute def execute
......
...@@ -11,7 +11,9 @@ module Metrics ...@@ -11,7 +11,9 @@ module Metrics
:create :create
def initialize(user, project, dashboard_path) def initialize(user, project, dashboard_path)
@user, @project, @dashboard_path = user, project, dashboard_path @user = user
@project = project
@dashboard_path = dashboard_path
end end
def execute def execute
......
...@@ -5,7 +5,9 @@ module Metrics ...@@ -5,7 +5,9 @@ module Metrics
module UsersStarredDashboards module UsersStarredDashboards
class DeleteService < ::BaseService class DeleteService < ::BaseService
def initialize(user, project, dashboard_path = nil) def initialize(user, project, dashboard_path = nil)
@user, @project, @dashboard_path = user, project, dashboard_path @user = user
@project = project
@dashboard_path = dashboard_path
end end
def execute def execute
......
...@@ -6,7 +6,9 @@ module Milestones ...@@ -6,7 +6,9 @@ module Milestones
attr_accessor :parent, :current_user, :params attr_accessor :parent, :current_user, :params
def initialize(parent, user, params = {}) def initialize(parent, user, params = {})
@parent, @current_user, @params = parent, user, params.dup @parent = parent
@current_user = user
@params = params.dup
super super
end end
end end
......
...@@ -5,7 +5,9 @@ module Milestones ...@@ -5,7 +5,9 @@ module Milestones
attr_accessor :project, :current_user, :params attr_accessor :project, :current_user, :params
def initialize(project, user, params = {}) def initialize(project, user, params = {})
@project, @current_user, @params = project, user, params.dup @project = project
@current_user = user
@params = params.dup
end end
def execute def execute
......
...@@ -6,7 +6,9 @@ module NotificationRecipients ...@@ -6,7 +6,9 @@ module NotificationRecipients
attr_reader :merge_request, :current_user, :reviewer attr_reader :merge_request, :current_user, :reviewer
def initialize(merge_request, current_user, reviewer) def initialize(merge_request, current_user, reviewer)
@merge_request, @current_user, @reviewer = merge_request, current_user, reviewer @merge_request = merge_request
@current_user = current_user
@reviewer = reviewer
end end
def target def target
......
...@@ -6,7 +6,8 @@ module Packages ...@@ -6,7 +6,8 @@ module Packages
InvalidJson = Class.new(StandardError) InvalidJson = Class.new(StandardError)
def initialize(project, target) def initialize(project, target)
@project, @target = project, target @project = project
@target = target
end end
def execute def execute
......
...@@ -4,7 +4,8 @@ module Packages ...@@ -4,7 +4,8 @@ module Packages
module Composer module Composer
class VersionParserService class VersionParserService
def initialize(tag_name: nil, branch_name: nil) def initialize(tag_name: nil, branch_name: nil)
@tag_name, @branch_name = tag_name, branch_name @tag_name = tag_name
@branch_name = branch_name
end end
def execute def execute
......
...@@ -4,7 +4,8 @@ module Packages ...@@ -4,7 +4,8 @@ module Packages
module Debian module Debian
class CreateDistributionService class CreateDistributionService
def initialize(container, user, params) def initialize(container, user, params)
@container, @params = container, params @container = container
@params = params
@params[:creator] = user @params[:creator] = user
@components = params.delete(:components) || ['main'] @components = params.delete(:components) || ['main']
......
...@@ -4,7 +4,8 @@ module Packages ...@@ -4,7 +4,8 @@ module Packages
module Debian module Debian
class UpdateDistributionService class UpdateDistributionService
def initialize(distribution, params) def initialize(distribution, params)
@distribution, @params = distribution, params @distribution = distribution
@params = params
@components = params.delete(:components) @components = params.delete(:components)
......
...@@ -33,7 +33,8 @@ module Packages ...@@ -33,7 +33,8 @@ module Packages
# #
# The first upload has to create the proper package (the one with the version set). # The first upload has to create the proper package (the one with the version set).
if params[:file_name] == Packages::Maven::Metadata.filename && !params[:path]&.ends_with?(SNAPSHOT_TERM) if params[:file_name] == Packages::Maven::Metadata.filename && !params[:path]&.ends_with?(SNAPSHOT_TERM)
package_name, version = params[:path], nil package_name = params[:path]
version = nil
else else
package_name, _, version = params[:path].rpartition('/') package_name, _, version = params[:path].rpartition('/')
end end
......
...@@ -71,7 +71,8 @@ class Projects::BranchesByModeService ...@@ -71,7 +71,8 @@ class Projects::BranchesByModeService
# And increase it whenever we go to the next page # And increase it whenever we go to the next page
previous_offset = params[:offset].to_i previous_offset = params[:offset].to_i
previous_path, next_path = nil, nil previous_path = nil
next_path = nil
return [branches, previous_path, next_path] if branches.blank? return [branches, previous_path, next_path] if branches.blank?
......
...@@ -7,7 +7,8 @@ module Projects ...@@ -7,7 +7,8 @@ module Projects
attr_reader :template_name attr_reader :template_name
def initialize(user, params) def initialize(user, params)
@current_user, @params = user, params.to_h.dup @current_user = user
@params = params.to_h.dup
@template_name = @params.delete(:template_name).presence @template_name = @params.delete(:template_name).presence
end end
......
...@@ -5,11 +5,12 @@ module Projects ...@@ -5,11 +5,12 @@ module Projects
include ValidatesClassificationLabel include ValidatesClassificationLabel
def initialize(user, params) def initialize(user, params)
@current_user, @params = user, params.dup @current_user = user
@skip_wiki = @params.delete(:skip_wiki) @params = params.dup
@skip_wiki = @params.delete(:skip_wiki)
@initialize_with_readme = Gitlab::Utils.to_boolean(@params.delete(:initialize_with_readme)) @initialize_with_readme = Gitlab::Utils.to_boolean(@params.delete(:initialize_with_readme))
@import_data = @params.delete(:import_data) @import_data = @params.delete(:import_data)
@relations_block = @params.delete(:relations_block) @relations_block = @params.delete(:relations_block)
end end
def execute def execute
......
...@@ -7,7 +7,8 @@ module Projects ...@@ -7,7 +7,8 @@ module Projects
].freeze ].freeze
def initialize(project, url) def initialize(project, url)
@project, @url = project, url @project = project
@url = url
end end
def execute def execute
......
...@@ -11,7 +11,9 @@ module Projects ...@@ -11,7 +11,9 @@ module Projects
attr_reader :current_user, :params attr_reader :current_user, :params
def initialize(user, import_params, override_params = nil) def initialize(user, import_params, override_params = nil)
@current_user, @params, @override_params = user, import_params.dup, override_params @current_user = user
@params = import_params.dup
@override_params = override_params
end end
def execute def execute
......
...@@ -23,7 +23,8 @@ module Projects ...@@ -23,7 +23,8 @@ module Projects
attr_reader :build attr_reader :build
def initialize(project, build) def initialize(project, build)
@project, @build = project, build @project = project
@build = build
end end
def execute def execute
......
...@@ -41,7 +41,8 @@ module Prometheus ...@@ -41,7 +41,8 @@ module Prometheus
# } # }
# }) # })
def initialize(environment, params = {}) def initialize(environment, params = {})
@environment, @params = environment, params.deep_dup @environment = environment
@params = params.deep_dup
end end
# @return - params [Hash<Symbol,Any>] Returns a Hash containing a params key which is # @return - params [Hash<Symbol,Any>] Returns a Hash containing a params key which is
......
...@@ -8,7 +8,9 @@ module Releases ...@@ -8,7 +8,9 @@ module Releases
attr_accessor :project, :current_user, :params attr_accessor :project, :current_user, :params
def initialize(project, user = nil, params = {}) def initialize(project, user = nil, params = {})
@project, @current_user, @params = project, user, params.dup @project = project
@current_user = user
@params = params.dup
end end
def tag_name def tag_name
......
...@@ -5,7 +5,8 @@ module ResourceEvents ...@@ -5,7 +5,8 @@ module ResourceEvents
attr_reader :resource, :user attr_reader :resource, :user
def initialize(resource, user) def initialize(resource, user)
@resource, @user = resource, user @resource = resource
@user = user
end end
def execute(added_labels: [], removed_labels: []) def execute(added_labels: [], removed_labels: [])
......
...@@ -5,7 +5,8 @@ module ResourceEvents ...@@ -5,7 +5,8 @@ module ResourceEvents
attr_reader :resource, :user attr_reader :resource, :user
def initialize(user:, resource:) def initialize(user:, resource:)
@user, @resource = user, resource @user = user
@resource = resource
end end
def execute(params) def execute(params)
......
...@@ -9,7 +9,8 @@ module Search ...@@ -9,7 +9,8 @@ module Search
attr_accessor :current_user, :params attr_accessor :current_user, :params
def initialize(user, params) def initialize(user, params)
@current_user, @params = user, params.dup @current_user = user
@params = params.dup
end end
def execute def execute
......
...@@ -9,7 +9,9 @@ module Search ...@@ -9,7 +9,9 @@ module Search
attr_accessor :project, :current_user, :params attr_accessor :project, :current_user, :params
def initialize(project, user, params) def initialize(project, user, params)
@project, @current_user, @params = project, user, params.dup @project = project
@current_user = user
@params = params.dup
end end
def execute def execute
......
...@@ -9,9 +9,11 @@ class TaskListToggleService ...@@ -9,9 +9,11 @@ class TaskListToggleService
attr_reader :updated_markdown, :updated_markdown_html attr_reader :updated_markdown, :updated_markdown_html
def initialize(markdown, markdown_html, line_source:, line_number:, toggle_as_checked:) def initialize(markdown, markdown_html, line_source:, line_number:, toggle_as_checked:)
@markdown, @markdown_html = markdown, markdown_html @markdown = markdown
@line_source, @line_number = line_source, line_number @markdown_html = markdown_html
@toggle_as_checked = toggle_as_checked @line_source = line_source
@line_number = line_number
@toggle_as_checked = toggle_as_checked
@updated_markdown, @updated_markdown_html = nil @updated_markdown, @updated_markdown_html = nil
end end
......
...@@ -7,7 +7,8 @@ module TwoFactor ...@@ -7,7 +7,8 @@ module TwoFactor
attr_reader :current_user, :params, :user attr_reader :current_user, :params, :user
def initialize(current_user, params = {}) def initialize(current_user, params = {})
@current_user, @params = current_user, params @current_user = current_user
@params = params
@user = params.delete(:user) @user = params.delete(:user)
end end
end end
......
...@@ -5,7 +5,10 @@ class UploadService ...@@ -5,7 +5,10 @@ class UploadService
attr_accessor :override_max_attachment_size attr_accessor :override_max_attachment_size
def initialize(model, file, uploader_class = FileUploader, **uploader_context) def initialize(model, file, uploader_class = FileUploader, **uploader_context)
@model, @file, @uploader_class, @uploader_context = model, file, uploader_class, uploader_context @model = model
@file = file
@uploader_class = uploader_class
@uploader_context = uploader_context
end end
def execute def execute
......
...@@ -4,7 +4,8 @@ class UserAgentDetailService ...@@ -4,7 +4,8 @@ class UserAgentDetailService
attr_accessor :spammable, :request attr_accessor :spammable, :request
def initialize(spammable, request) def initialize(spammable, request)
@spammable, @request = spammable, request @spammable = spammable
@request = request
end end
def create def create
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
module Users module Users
class RespondToTermsService class RespondToTermsService
def initialize(user, term) def initialize(user, term)
@user, @term = user, term @user = user
@term = term
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
......
...@@ -7,7 +7,8 @@ module Users ...@@ -7,7 +7,8 @@ module Users
attr_reader :current_user, :target_user, :params attr_reader :current_user, :target_user, :params
def initialize(current_user, params) def initialize(current_user, params)
@current_user, @params = current_user, params.dup @current_user = current_user
@params = params.dup
@target_user = params.delete(:user) || current_user @target_user = params.delete(:user) || current_user
end end
......
- note_count = @issuable_meta_data[issuable.id].user_notes_count - note_count = @issuable_meta_data[issuable.id].user_notes_count
- issue_votes = @issuable_meta_data[issuable.id] - issue_votes = @issuable_meta_data[issuable.id]
- upvotes, downvotes = issue_votes.upvotes, issue_votes.downvotes - upvotes = issue_votes.upvotes
- downvotes = issue_votes.downvotes
- issuable_path = issuable_path(issuable, anchor: 'notes') - issuable_path = issuable_path(issuable, anchor: 'notes')
- issuable_mr = @issuable_meta_data[issuable.id].merge_requests_count - issuable_mr = @issuable_meta_data[issuable.id].merge_requests_count
......
...@@ -16,7 +16,8 @@ module ObjectStorage ...@@ -16,7 +16,8 @@ module ObjectStorage
attr_accessor :error attr_accessor :error
def initialize(upload, error = nil) def initialize(upload, error = nil)
@upload, @error = upload, error @upload = upload
@error = error
end end
def success? def success?
......
---
title: Resolves offenses Style/ParallelAssignment
merge_request: 57999
author: Shubham Kumar (@imskr)
type: fixed
...@@ -8,7 +8,9 @@ module Admin ...@@ -8,7 +8,9 @@ module Admin
LEASE_KEY = 'admin/email_service' LEASE_KEY = 'admin/email_service'
def initialize(recipients, subject, body) def initialize(recipients, subject, body)
@recipients, @subject, @body = recipients, subject, body @recipients = recipients
@subject = subject
@body = body
end end
def execute def execute
......
...@@ -7,7 +7,9 @@ module Epics ...@@ -7,7 +7,9 @@ module Epics
attr_reader :group, :parent_epic, :child_epic attr_reader :group, :parent_epic, :child_epic
def initialize(group, current_user, params = {}) def initialize(group, current_user, params = {})
@group, @current_user, @params = group, current_user, params @group = group
@current_user = current_user
@params = params
end end
private private
......
...@@ -8,7 +8,9 @@ module Iterations ...@@ -8,7 +8,9 @@ module Iterations
attr_accessor :group, :current_user, :params attr_accessor :group, :current_user, :params
def initialize(group, user, params = {}) def initialize(group, user, params = {})
@group, @current_user, @params = group, user, params.dup @group = group
@current_user = user
@params = params.dup
end end
def execute def execute
......
...@@ -6,7 +6,9 @@ module Iterations ...@@ -6,7 +6,9 @@ module Iterations
include Gitlab::Allowable include Gitlab::Allowable
def initialize(iteration_cadence, user, params = {}) def initialize(iteration_cadence, user, params = {})
@iteration_cadence, @current_user, @params = iteration_cadence, user, params.dup @iteration_cadence = iteration_cadence
@current_user = user
@params = params.dup
end end
def execute def execute
......
...@@ -8,7 +8,9 @@ module Iterations ...@@ -8,7 +8,9 @@ module Iterations
attr_accessor :parent, :current_user, :params attr_accessor :parent, :current_user, :params
def initialize(parent, user, params = {}) def initialize(parent, user, params = {})
@parent, @current_user, @params = parent, user, params.dup @parent = parent
@current_user = user
@params = params.dup
end end
def execute def execute
......
...@@ -9,7 +9,9 @@ module Iterations ...@@ -9,7 +9,9 @@ module Iterations
attr_accessor :parent, :current_user, :params attr_accessor :parent, :current_user, :params
def initialize(parent, user, params = {}) def initialize(parent, user, params = {})
@parent, @current_user, @params = parent, user, params.dup @parent = parent
@current_user = user
@params = params.dup
end end
def execute(iteration) def execute(iteration)
......
...@@ -5,7 +5,8 @@ module Licenses ...@@ -5,7 +5,8 @@ module Licenses
include Gitlab::Allowable include Gitlab::Allowable
def initialize(license, user) def initialize(license, user)
@license, @user = license, user @license = license
@user = user
end end
def execute def execute
......
...@@ -70,7 +70,8 @@ module Security ...@@ -70,7 +70,8 @@ module Security
def sort_findings! def sort_findings!
@findings.sort! do |a, b| @findings.sort! do |a, b|
a_severity, b_severity = a.severity, b.severity a_severity = a.severity
b_severity = b.severity
if a_severity == b_severity if a_severity == b_severity
a.compare_key <=> b.compare_key a.compare_key <=> b.compare_key
...@@ -99,7 +100,8 @@ module Security ...@@ -99,7 +100,8 @@ module Security
return unless reports_sortable? return unless reports_sortable?
@source_reports.sort! do |a, b| @source_reports.sort! do |a, b|
a_scanner_id, b_scanner_id = a.scanners.values[0].external_id, b.scanners.values[0].external_id a_scanner_id = a.scanners.values[0].external_id
b_scanner_id = b.scanners.values[0].external_id
a_scanner_id = "unknown" if ANALYZER_ORDER[a_scanner_id].nil? a_scanner_id = "unknown" if ANALYZER_ORDER[a_scanner_id].nil?
b_scanner_id = "unknown" if ANALYZER_ORDER[b_scanner_id].nil? b_scanner_id = "unknown" if ANALYZER_ORDER[b_scanner_id].nil?
......
...@@ -5,7 +5,10 @@ module VulnerabilityFeedback ...@@ -5,7 +5,10 @@ module VulnerabilityFeedback
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
def initialize(project, user, vulnerability_feedback, revert_vulnerability_state: true) def initialize(project, user, vulnerability_feedback, revert_vulnerability_state: true)
@project, @current_user, @vulnerability_feedback, @revert_vulnerability_state = project, user, vulnerability_feedback, revert_vulnerability_state @project = project
@current_user = user
@vulnerability_feedback = vulnerability_feedback
@revert_vulnerability_state = revert_vulnerability_state
end end
def execute def execute
......
...@@ -10,7 +10,9 @@ class RepositoryPushAuditEventWorker # rubocop:disable Scalability/IdempotentWor ...@@ -10,7 +10,9 @@ class RepositoryPushAuditEventWorker # rubocop:disable Scalability/IdempotentWor
user = User.find(user_id) user = User.find(user_id)
changes.map! do |change| changes.map! do |change|
before, after, ref = change['before'], change['after'], change['ref'] before = change['before']
after = change['after']
ref = change['ref']
service = EE::AuditEvents::RepositoryPushAuditEventService service = EE::AuditEvents::RepositoryPushAuditEventService
.new(user, project, ref, before, after) .new(user, project, ref, before, after)
......
...@@ -6,7 +6,8 @@ module Elastic ...@@ -6,7 +6,8 @@ module Elastic
attr_reader :class_name, :record_id attr_reader :class_name, :record_id
def initialize(class_name, record_id) def initialize(class_name, record_id)
@class_name, @record_id = class_name, record_id @class_name = class_name
@record_id = record_id
end end
def message def message
......
...@@ -6,7 +6,9 @@ module Gitlab ...@@ -6,7 +6,9 @@ module Gitlab
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
def initialize(project, ref, paths) def initialize(project, ref, paths)
@project, @ref, @paths = project, ref, Array(paths) @project = project
@ref = ref
@paths = Array(paths)
end end
def entries def entries
......
...@@ -62,7 +62,8 @@ RSpec.describe 'EE > Projects > Licenses > Maintainer views policies', :js do ...@@ -62,7 +62,8 @@ RSpec.describe 'EE > Projects > Licenses > Maintainer views policies', :js do
end end
def label_for(dependency) def label_for(dependency)
name, version = dependency['name'], dependency['version'] name = dependency['name']
version = dependency['version']
version ? "#{name} (#{version})" : name version ? "#{name} (#{version})" : name
end end
......
...@@ -18,7 +18,8 @@ module Banzai ...@@ -18,7 +18,8 @@ module Banzai
def references_in(text, pattern = Label.reference_pattern) def references_in(text, pattern = Label.reference_pattern)
labels = {} labels = {}
unescaped_html = unescape_html_entities(text).gsub(pattern) do |match| unescaped_html = unescape_html_entities(text).gsub(pattern) do |match|
namespace, project = $~[:namespace], $~[:project] namespace = $~[:namespace]
project = $~[:project]
project_path = full_project_path(namespace, project) project_path = full_project_path(namespace, project)
label = find_label_cached(project_path, $~[:label_id], $~[:label_name]) label = find_label_cached(project_path, $~[:label_id], $~[:label_name])
......
...@@ -5,7 +5,8 @@ module ContainerRegistry ...@@ -5,7 +5,8 @@ module ContainerRegistry
attr_reader :tag, :blob, :data attr_reader :tag, :blob, :data
def initialize(tag, blob) def initialize(tag, blob)
@tag, @blob = tag, blob @tag = tag
@blob = blob
@data = Gitlab::Json.parse(blob.data) @data = Gitlab::Json.parse(blob.data)
end end
......
...@@ -10,7 +10,8 @@ module ContainerRegistry ...@@ -10,7 +10,8 @@ module ContainerRegistry
delegate :revision, :short_revision, to: :config_blob, allow_nil: true delegate :revision, :short_revision, to: :config_blob, allow_nil: true
def initialize(repository, name) def initialize(repository, name)
@repository, @name = repository, name @repository = repository
@name = name
end end
def valid? def valid?
......
...@@ -5,7 +5,8 @@ module DeclarativePolicy ...@@ -5,7 +5,8 @@ module DeclarativePolicy
PREFERRED_SCOPE_KEY = :"DeclarativePolicy.preferred_scope" PREFERRED_SCOPE_KEY = :"DeclarativePolicy.preferred_scope"
def with_preferred_scope(scope) def with_preferred_scope(scope)
Thread.current[PREFERRED_SCOPE_KEY], old_scope = scope, Thread.current[PREFERRED_SCOPE_KEY] old_scope = Thread.current[PREFERRED_SCOPE_KEY]
Thread.current[PREFERRED_SCOPE_KEY] = scope
yield yield
ensure ensure
Thread.current[PREFERRED_SCOPE_KEY] = old_scope Thread.current[PREFERRED_SCOPE_KEY] = old_scope
......
...@@ -11,7 +11,8 @@ class FileSizeValidator < ActiveModel::EachValidator ...@@ -11,7 +11,8 @@ class FileSizeValidator < ActiveModel::EachValidator
if range = (options.delete(:in) || options.delete(:within)) if range = (options.delete(:in) || options.delete(:within))
raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range) raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range)
options[:minimum], options[:maximum] = range.begin, range.end options[:minimum] = range.begin
options[:maximum] = range.end
options[:maximum] -= 1 if range.exclude_end? options[:maximum] -= 1 if range.exclude_end?
end end
......
...@@ -46,7 +46,8 @@ module Gitlab ...@@ -46,7 +46,8 @@ module Gitlab
def initialize(namespace, queue_id) def initialize(namespace, queue_id)
raise ArgumentError if namespace.empty? || queue_id.empty? raise ArgumentError if namespace.empty? || queue_id.empty?
@namespace, @queue_id = namespace, queue_id @namespace = namespace
@queue_id = queue_id
end end
## ##
......
...@@ -69,7 +69,9 @@ module Gitlab ...@@ -69,7 +69,9 @@ module Gitlab
def load_from_project def load_from_project
return unless commit return unless commit
self.sha, self.status, self.ref = commit.sha, commit.status, project.default_branch self.sha = commit.sha
self.status = commit.status
self.ref = project.default_branch
end end
# We only cache the status for the HEAD commit of a project # We only cache the status for the HEAD commit of a project
......
...@@ -17,7 +17,9 @@ module Gitlab ...@@ -17,7 +17,9 @@ module Gitlab
attr_reader :stream, :path, :full_version attr_reader :stream, :path, :full_version
def initialize(stream, path, **opts) def initialize(stream, path, **opts)
@stream, @path, @opts = stream, path, opts @stream = stream
@path = path
@opts = opts
@full_version = read_version @full_version = read_version
end end
......
...@@ -5,7 +5,9 @@ module Gitlab ...@@ -5,7 +5,9 @@ module Gitlab
attr_accessor :email, :name, :commits, :additions, :deletions attr_accessor :email, :name, :commits, :additions, :deletions
def initialize def initialize
@commits, @additions, @deletions = 0, 0, 0 @commits = 0
@additions = 0
@deletions = 0
end end
end end
end end
...@@ -13,8 +13,11 @@ module Gitlab ...@@ -13,8 +13,11 @@ module Gitlab
attr_accessor :index, :type, :old_pos, :new_pos attr_accessor :index, :type, :old_pos, :new_pos
def initialize(text, type, index, old_pos, new_pos, parent_file: nil, line_code: nil, rich_text: nil) def initialize(text, type, index, old_pos, new_pos, parent_file: nil, line_code: nil, rich_text: nil)
@text, @type, @index = text, type, index @text = text
@old_pos, @new_pos = old_pos, new_pos @type = type
@index = index
@old_pos = old_pos
@new_pos = new_pos
@parent_file = parent_file @parent_file = parent_file
@rich_text = rich_text @rich_text = rich_text
......
...@@ -29,9 +29,8 @@ module Gitlab ...@@ -29,9 +29,8 @@ module Gitlab
lines_above, lines_below = nil lines_above, lines_below = nil
if lang_param && suggestion_params = fetch_suggestion_params(lang_param) if lang_param && suggestion_params = fetch_suggestion_params(lang_param)
lines_above, lines_below = lines_above = suggestion_params[:above]
suggestion_params[:above], lines_below = suggestion_params[:below]
suggestion_params[:below]
end end
Gitlab::Diff::Suggestion.new(node.text, Gitlab::Diff::Suggestion.new(node.text,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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