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:
Style/NumericLiteralPrefix:
Enabled: false
# Offense count: 140
# Cop supports --auto-correct.
Style/ParallelAssignment:
Enabled: false
# Offense count: 2698
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
......
......@@ -308,7 +308,8 @@ class Clusters::ClustersController < Clusters::BaseController
def proxy_variable_substitution_service
@empty_service ||= Class.new(BaseService) do
def initialize(proxyable, params)
@proxyable, @params = proxyable, params
@proxyable = proxyable
@params = params
end
def execute
......
......@@ -63,7 +63,8 @@ class Projects::CommitsController < Projects::ApplicationController
def set_commits
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]
author = params[:author]
......
......@@ -3,7 +3,8 @@
module Ci
class VariablesFinder
def initialize(resource, params)
@resource, @params = resource, params
@resource = resource
@params = params
raise ArgumentError, 'Please provide params[:key]' if params[:key].blank?
end
......
......@@ -4,7 +4,9 @@ class EnvironmentsByDeploymentsFinder
attr_reader :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
# rubocop: disable CodeReuse/ActiveRecord
......
......@@ -6,7 +6,9 @@ class EnvironmentsFinder
InvalidStatesError = Class.new(StandardError)
def initialize(project, current_user, params = {})
@project, @current_user, @params = project, current_user, params
@project = project
@current_user = current_user
@params = params
end
def execute
......
......@@ -4,7 +4,8 @@ module Metrics
module Dashboards
class AnnotationsFinder
def initialize(dashboard:, params:)
@dashboard, @params = dashboard, params
@dashboard = dashboard
@params = params
end
def execute
......
......@@ -3,7 +3,9 @@
module Metrics
class UsersStarredDashboardsFinder
def initialize(user:, project:, params: {})
@user, @project, @params = user, project, params
@user = user
@project = project
@params = params
end
def execute
......
......@@ -4,7 +4,8 @@ module Packages
module Debian
class DistributionsFinder
def initialize(container, params = {})
@container, @params = container, params
@container = container
@params = params
end
def execute
......
......@@ -18,7 +18,8 @@ module SubmoduleHelper
end
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.config.gitlab_shell.ssh_path_prefix]
......
......@@ -58,7 +58,8 @@ class Ability
def allowed?(user, action, subject = :global, opts = {})
if subject.is_a?(Hash)
opts, subject = subject, :global
opts = subject
subject = :global
end
policy = policy_for(user, subject)
......
......@@ -438,11 +438,14 @@ module ApplicationSettingImplementation
def parse_addr_and_port(str)
case str
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"
address, port = $~[:address], $~[:port]
address = $~[:address]
port = $~[:port]
else # string with no port number
address, port = str, nil
address = str
port = nil
end
[address, port&.to_i]
......
......@@ -62,7 +62,8 @@ class Commit
collection.sort do |a, b|
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
order_by.in?(%w[email name]) ? attr1.casecmp(attr2) : attr1 <=> attr2
......
......@@ -30,7 +30,8 @@ module Taskable
end
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|
old_task = old_tasks[i]
......
......@@ -29,7 +29,9 @@ module DesignManagement
# - design [DesignManagement::Design]: the design that was changed
# - action [Symbol]: the action that gitaly performed
def initialize(design, action, content = nil)
@design, @action, @content = design, action, content
@design = design
@action = action
@content = content
validate!
end
......
......@@ -18,7 +18,8 @@ module DesignManagement
validate :design_and_version_have_issue_id
def initialize(design: nil, version: nil)
@design, @version = design, version
@design = design
@version = version
end
# The ID, needed by GraphQL types and as part of the Lazy-fetch
......
......@@ -14,7 +14,9 @@ module DesignManagement
attr_reader :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
def message
......
......@@ -6,7 +6,8 @@ class ExternalIssue
attr_reader :project
def initialize(issue_identifier, project)
@issue_identifier, @project = issue_identifier, project
@issue_identifier = issue_identifier
@project = project
end
def to_s
......
......@@ -291,7 +291,9 @@ class Member < ApplicationRecord
private
def parse_users_list(source, list)
emails, user_ids, users = [], [], []
emails = []
user_ids = []
users = []
existing_members = {}
list.each do |item|
......
......@@ -13,7 +13,9 @@ module Preloaders
attr_reader :labels, :user, :project
def initialize(labels, user, project = nil)
@labels, @user, @project = labels, user, project
@labels = labels
@user = user
@project = project
end
def preload_all
......
......@@ -3,7 +3,9 @@
module ApplicationSettings
class BaseService < ::BaseService
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
......@@ -7,6 +7,8 @@ class BaseContainerService
attr_reader :container, :current_user, :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
......@@ -15,7 +15,9 @@ class BaseService
attr_accessor :project, :current_user, :params
def initialize(project, user = nil, params = {})
@project, @current_user, @params = project, user, params.dup
@project = project
@current_user = user
@params = params.dup
end
delegate :repository, to: :project
......
......@@ -6,7 +6,9 @@ module Boards
attr_accessor :parent, :current_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
......
......@@ -96,7 +96,8 @@ module Ci
# rubocop: enable Metrics/ParameterLists
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|
unless pipeline.persisted?
......
......@@ -5,7 +5,8 @@ module Clusters
attr_reader :current_user, :params
def initialize(user = nil, params = {})
@current_user, @params = user, params.dup
@current_user = user
@params = params.dup
end
def execute(access_token: nil)
......
......@@ -5,7 +5,8 @@ module Clusters
attr_reader :current_user, :params
def initialize(user = nil, params = {})
@current_user, @params = user, params.dup
@current_user = user
@params = params.dup
@response = {}
end
......
......@@ -5,7 +5,8 @@ module Clusters
attr_reader :current_user, :params
def initialize(user = nil, params = {})
@current_user, @params = user, params.dup
@current_user = user
@params = params.dup
end
def execute(cluster)
......
......@@ -5,7 +5,9 @@ module DraftNotes
attr_accessor :merge_request, :current_user, :params
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
def merge_request_activity_counter
......
......@@ -8,7 +8,9 @@ module Git
attr_reader :wiki
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
def execute
......
......@@ -9,7 +9,9 @@ module Git
# @param [Hash] change - must have keys `:oldrev` and `:newrev`
# @param [Gitlab::Git::RawDiffChange] 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
def page
......
......@@ -5,7 +5,9 @@ module Groups
attr_accessor :group, :current_user, :params
def initialize(group, user, params = {})
@group, @current_user, @params = group, user, params.dup
@group = group
@current_user = user
@params = params.dup
end
private
......
......@@ -3,7 +3,8 @@
module Groups
class CreateService < Groups::BaseService
def initialize(user, params = {})
@current_user, @params = user, params.dup
@current_user = user
@params = params.dup
@chat_team = @params.delete(:create_chat_team)
end
......
......@@ -5,7 +5,8 @@ module Groups
attr_reader :group_path, :visibility_level
def initialize(user, params)
@current_user, @params = user, params.dup
@current_user = user
@params = params.dup
@group_path = @params.delete(:group_path)
@visibility_level = @params.delete(:visibility_level) ||
Gitlab::CurrentSettings.current_application_settings.default_group_visibility
......
......@@ -7,7 +7,9 @@ module Issuable
attr_accessor :parent, :current_user, :params
def initialize(parent, user = nil, params = {})
@parent, @current_user, @params = parent, user, params.dup
@parent = parent
@current_user = user
@params = params.dup
end
def execute(type)
......
......@@ -7,7 +7,9 @@ module IssuableLinks
attr_reader :issuable, :current_user, :params
def initialize(issuable, user, params)
@issuable, @current_user, @params = issuable, user, params.dup
@issuable = issuable
@current_user = user
@params = params.dup
end
def execute
......
......@@ -7,7 +7,8 @@ module IssuableLinks
attr_reader :issuable, :current_user
def initialize(issuable, user)
@issuable, @current_user = issuable, user
@issuable = issuable
@current_user = user
end
def execute
......
......@@ -5,7 +5,9 @@ module JiraConnectSubscriptions
attr_accessor :jira_connect_installation, :current_user, :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
......@@ -5,7 +5,8 @@ module Keys
attr_accessor :user, :params
def initialize(user, params = {})
@user, @params = user, params
@user = user
@params = params
@ip_address = @params.delete(:ip_address)
end
......
......@@ -5,7 +5,8 @@ module Keys
attr_accessor :current_user
def initialize(current_user, params = {})
@current_user, @params = current_user, params
@current_user = current_user
@params = params
@ip_address = @params.delete(:ip_address)
@user = params.delete(:user) || current_user
end
......
......@@ -3,7 +3,8 @@
module Mattermost
class CreateTeamService < ::BaseService
def initialize(group, current_user)
@group, @current_user = group, current_user
@group = group
@current_user = current_user
end
def execute
......
......@@ -13,7 +13,8 @@ module Metrics
:create
def initialize(user, params)
@user, @params = user, params
@user = user
@params = params
end
def execute
......
......@@ -11,7 +11,8 @@ module Metrics
:delete
def initialize(user, annotation)
@user, @annotation = user, annotation
@user = user
@annotation = annotation
end
def execute
......
......@@ -122,7 +122,8 @@ module Metrics
# Identifies the uid of the dashboard based on url format
class GrafanaUidParser
def initialize(grafana_url, project)
@grafana_url, @project = grafana_url, project
@grafana_url = grafana_url
@project = project
end
def parse
......@@ -145,7 +146,8 @@ module Metrics
# If no panel is specified, defaults to the first valid panel.
class DatasourceNameParser
def initialize(grafana_url, grafana_dashboard)
@grafana_url, @grafana_dashboard = grafana_url, grafana_dashboard
@grafana_url = grafana_url
@grafana_dashboard = grafana_dashboard
end
def parse
......
......@@ -22,7 +22,9 @@ module Metrics
].freeze
def initialize(project, panel_yaml, environment)
@project, @panel_yaml, @environment = project, panel_yaml, environment
@project = project
@panel_yaml = panel_yaml
@environment = environment
end
def execute
......
......@@ -11,7 +11,9 @@ module Metrics
:create
def initialize(user, project, dashboard_path)
@user, @project, @dashboard_path = user, project, dashboard_path
@user = user
@project = project
@dashboard_path = dashboard_path
end
def execute
......
......@@ -5,7 +5,9 @@ module Metrics
module UsersStarredDashboards
class DeleteService < ::BaseService
def initialize(user, project, dashboard_path = nil)
@user, @project, @dashboard_path = user, project, dashboard_path
@user = user
@project = project
@dashboard_path = dashboard_path
end
def execute
......
......@@ -6,7 +6,9 @@ module Milestones
attr_accessor :parent, :current_user, :params
def initialize(parent, user, params = {})
@parent, @current_user, @params = parent, user, params.dup
@parent = parent
@current_user = user
@params = params.dup
super
end
end
......
......@@ -5,7 +5,9 @@ module Milestones
attr_accessor :project, :current_user, :params
def initialize(project, user, params = {})
@project, @current_user, @params = project, user, params.dup
@project = project
@current_user = user
@params = params.dup
end
def execute
......
......@@ -6,7 +6,9 @@ module NotificationRecipients
attr_reader :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
def target
......
......@@ -6,7 +6,8 @@ module Packages
InvalidJson = Class.new(StandardError)
def initialize(project, target)
@project, @target = project, target
@project = project
@target = target
end
def execute
......
......@@ -4,7 +4,8 @@ module Packages
module Composer
class VersionParserService
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
def execute
......
......@@ -4,7 +4,8 @@ module Packages
module Debian
class CreateDistributionService
def initialize(container, user, params)
@container, @params = container, params
@container = container
@params = params
@params[:creator] = user
@components = params.delete(:components) || ['main']
......
......@@ -4,7 +4,8 @@ module Packages
module Debian
class UpdateDistributionService
def initialize(distribution, params)
@distribution, @params = distribution, params
@distribution = distribution
@params = params
@components = params.delete(:components)
......
......@@ -33,7 +33,8 @@ module Packages
#
# 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)
package_name, version = params[:path], nil
package_name = params[:path]
version = nil
else
package_name, _, version = params[:path].rpartition('/')
end
......
......@@ -71,7 +71,8 @@ class Projects::BranchesByModeService
# And increase it whenever we go to the next page
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?
......
......@@ -7,7 +7,8 @@ module Projects
attr_reader :template_name
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
end
......
......@@ -5,11 +5,12 @@ module Projects
include ValidatesClassificationLabel
def initialize(user, params)
@current_user, @params = user, params.dup
@skip_wiki = @params.delete(:skip_wiki)
@current_user = user
@params = params.dup
@skip_wiki = @params.delete(:skip_wiki)
@initialize_with_readme = Gitlab::Utils.to_boolean(@params.delete(:initialize_with_readme))
@import_data = @params.delete(:import_data)
@relations_block = @params.delete(:relations_block)
@import_data = @params.delete(:import_data)
@relations_block = @params.delete(:relations_block)
end
def execute
......
......@@ -7,7 +7,8 @@ module Projects
].freeze
def initialize(project, url)
@project, @url = project, url
@project = project
@url = url
end
def execute
......
......@@ -11,7 +11,9 @@ module Projects
attr_reader :current_user, :params
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
def execute
......
......@@ -23,7 +23,8 @@ module Projects
attr_reader :build
def initialize(project, build)
@project, @build = project, build
@project = project
@build = build
end
def execute
......
......@@ -41,7 +41,8 @@ module Prometheus
# }
# })
def initialize(environment, params = {})
@environment, @params = environment, params.deep_dup
@environment = environment
@params = params.deep_dup
end
# @return - params [Hash<Symbol,Any>] Returns a Hash containing a params key which is
......
......@@ -8,7 +8,9 @@ module Releases
attr_accessor :project, :current_user, :params
def initialize(project, user = nil, params = {})
@project, @current_user, @params = project, user, params.dup
@project = project
@current_user = user
@params = params.dup
end
def tag_name
......
......@@ -5,7 +5,8 @@ module ResourceEvents
attr_reader :resource, :user
def initialize(resource, user)
@resource, @user = resource, user
@resource = resource
@user = user
end
def execute(added_labels: [], removed_labels: [])
......
......@@ -5,7 +5,8 @@ module ResourceEvents
attr_reader :resource, :user
def initialize(user:, resource:)
@user, @resource = user, resource
@user = user
@resource = resource
end
def execute(params)
......
......@@ -9,7 +9,8 @@ module Search
attr_accessor :current_user, :params
def initialize(user, params)
@current_user, @params = user, params.dup
@current_user = user
@params = params.dup
end
def execute
......
......@@ -9,7 +9,9 @@ module Search
attr_accessor :project, :current_user, :params
def initialize(project, user, params)
@project, @current_user, @params = project, user, params.dup
@project = project
@current_user = user
@params = params.dup
end
def execute
......
......@@ -9,9 +9,11 @@ class TaskListToggleService
attr_reader :updated_markdown, :updated_markdown_html
def initialize(markdown, markdown_html, line_source:, line_number:, toggle_as_checked:)
@markdown, @markdown_html = markdown, markdown_html
@line_source, @line_number = line_source, line_number
@toggle_as_checked = toggle_as_checked
@markdown = markdown
@markdown_html = markdown_html
@line_source = line_source
@line_number = line_number
@toggle_as_checked = toggle_as_checked
@updated_markdown, @updated_markdown_html = nil
end
......
......@@ -7,7 +7,8 @@ module TwoFactor
attr_reader :current_user, :params, :user
def initialize(current_user, params = {})
@current_user, @params = current_user, params
@current_user = current_user
@params = params
@user = params.delete(:user)
end
end
......
......@@ -5,7 +5,10 @@ class UploadService
attr_accessor :override_max_attachment_size
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
def execute
......
......@@ -4,7 +4,8 @@ class UserAgentDetailService
attr_accessor :spammable, :request
def initialize(spammable, request)
@spammable, @request = spammable, request
@spammable = spammable
@request = request
end
def create
......
......@@ -3,7 +3,8 @@
module Users
class RespondToTermsService
def initialize(user, term)
@user, @term = user, term
@user = user
@term = term
end
# rubocop: disable CodeReuse/ActiveRecord
......
......@@ -7,7 +7,8 @@ module Users
attr_reader :current_user, :target_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
end
......
- note_count = @issuable_meta_data[issuable.id].user_notes_count
- 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_mr = @issuable_meta_data[issuable.id].merge_requests_count
......
......@@ -16,7 +16,8 @@ module ObjectStorage
attr_accessor :error
def initialize(upload, error = nil)
@upload, @error = upload, error
@upload = upload
@error = error
end
def success?
......
---
title: Resolves offenses Style/ParallelAssignment
merge_request: 57999
author: Shubham Kumar (@imskr)
type: fixed
......@@ -8,7 +8,9 @@ module Admin
LEASE_KEY = 'admin/email_service'
def initialize(recipients, subject, body)
@recipients, @subject, @body = recipients, subject, body
@recipients = recipients
@subject = subject
@body = body
end
def execute
......
......@@ -7,7 +7,9 @@ module Epics
attr_reader :group, :parent_epic, :child_epic
def initialize(group, current_user, params = {})
@group, @current_user, @params = group, current_user, params
@group = group
@current_user = current_user
@params = params
end
private
......
......@@ -8,7 +8,9 @@ module Iterations
attr_accessor :group, :current_user, :params
def initialize(group, user, params = {})
@group, @current_user, @params = group, user, params.dup
@group = group
@current_user = user
@params = params.dup
end
def execute
......
......@@ -6,7 +6,9 @@ module Iterations
include Gitlab::Allowable
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
def execute
......
......@@ -8,7 +8,9 @@ module Iterations
attr_accessor :parent, :current_user, :params
def initialize(parent, user, params = {})
@parent, @current_user, @params = parent, user, params.dup
@parent = parent
@current_user = user
@params = params.dup
end
def execute
......
......@@ -9,7 +9,9 @@ module Iterations
attr_accessor :parent, :current_user, :params
def initialize(parent, user, params = {})
@parent, @current_user, @params = parent, user, params.dup
@parent = parent
@current_user = user
@params = params.dup
end
def execute(iteration)
......
......@@ -5,7 +5,8 @@ module Licenses
include Gitlab::Allowable
def initialize(license, user)
@license, @user = license, user
@license = license
@user = user
end
def execute
......
......@@ -70,7 +70,8 @@ module Security
def sort_findings!
@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
a.compare_key <=> b.compare_key
......@@ -99,7 +100,8 @@ module Security
return unless reports_sortable?
@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?
b_scanner_id = "unknown" if ANALYZER_ORDER[b_scanner_id].nil?
......
......@@ -5,7 +5,10 @@ module VulnerabilityFeedback
include Gitlab::Utils::StrongMemoize
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
def execute
......
......@@ -10,7 +10,9 @@ class RepositoryPushAuditEventWorker # rubocop:disable Scalability/IdempotentWor
user = User.find(user_id)
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
.new(user, project, ref, before, after)
......
......@@ -6,7 +6,8 @@ module Elastic
attr_reader :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
def message
......
......@@ -6,7 +6,9 @@ module Gitlab
include ::Gitlab::Utils::StrongMemoize
def initialize(project, ref, paths)
@project, @ref, @paths = project, ref, Array(paths)
@project = project
@ref = ref
@paths = Array(paths)
end
def entries
......
......@@ -62,7 +62,8 @@ RSpec.describe 'EE > Projects > Licenses > Maintainer views policies', :js do
end
def label_for(dependency)
name, version = dependency['name'], dependency['version']
name = dependency['name']
version = dependency['version']
version ? "#{name} (#{version})" : name
end
......
......@@ -18,7 +18,8 @@ module Banzai
def references_in(text, pattern = Label.reference_pattern)
labels = {}
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)
label = find_label_cached(project_path, $~[:label_id], $~[:label_name])
......
......@@ -5,7 +5,8 @@ module ContainerRegistry
attr_reader :tag, :blob, :data
def initialize(tag, blob)
@tag, @blob = tag, blob
@tag = tag
@blob = blob
@data = Gitlab::Json.parse(blob.data)
end
......
......@@ -10,7 +10,8 @@ module ContainerRegistry
delegate :revision, :short_revision, to: :config_blob, allow_nil: true
def initialize(repository, name)
@repository, @name = repository, name
@repository = repository
@name = name
end
def valid?
......
......@@ -5,7 +5,8 @@ module DeclarativePolicy
PREFERRED_SCOPE_KEY = :"DeclarativePolicy.preferred_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
ensure
Thread.current[PREFERRED_SCOPE_KEY] = old_scope
......
......@@ -11,7 +11,8 @@ class FileSizeValidator < ActiveModel::EachValidator
if range = (options.delete(:in) || options.delete(:within))
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?
end
......
......@@ -46,7 +46,8 @@ module Gitlab
def initialize(namespace, queue_id)
raise ArgumentError if namespace.empty? || queue_id.empty?
@namespace, @queue_id = namespace, queue_id
@namespace = namespace
@queue_id = queue_id
end
##
......
......@@ -69,7 +69,9 @@ module Gitlab
def load_from_project
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
# We only cache the status for the HEAD commit of a project
......
......@@ -17,7 +17,9 @@ module Gitlab
attr_reader :stream, :path, :full_version
def initialize(stream, path, **opts)
@stream, @path, @opts = stream, path, opts
@stream = stream
@path = path
@opts = opts
@full_version = read_version
end
......
......@@ -5,7 +5,9 @@ module Gitlab
attr_accessor :email, :name, :commits, :additions, :deletions
def initialize
@commits, @additions, @deletions = 0, 0, 0
@commits = 0
@additions = 0
@deletions = 0
end
end
end
......@@ -13,8 +13,11 @@ module Gitlab
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)
@text, @type, @index = text, type, index
@old_pos, @new_pos = old_pos, new_pos
@text = text
@type = type
@index = index
@old_pos = old_pos
@new_pos = new_pos
@parent_file = parent_file
@rich_text = rich_text
......
......@@ -29,9 +29,8 @@ module Gitlab
lines_above, lines_below = nil
if lang_param && suggestion_params = fetch_suggestion_params(lang_param)
lines_above, lines_below =
suggestion_params[:above],
suggestion_params[:below]
lines_above = suggestion_params[:above]
lines_below = suggestion_params[:below]
end
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