Skip to content
Snippets Groups Projects
Commit 0430b764 authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Rémy Coutable
Browse files

Enable Style/DotPosition Rubocop :cop:

parent 78ee24ba
No related branches found
No related tags found
No related merge requests found
Showing
with 103 additions and 103 deletions
Loading
Loading
@@ -30,8 +30,8 @@ module Issues
 
Discussions::ResolveService.new(project, current_user,
merge_request: merge_request_to_resolve_discussions_of,
follow_up_issue: issue).
execute(discussions_to_resolve)
follow_up_issue: issue)
.execute(discussions_to_resolve)
end
 
private
Loading
Loading
Loading
Loading
@@ -26,29 +26,29 @@ module Labels
private
 
def label_ids_for_merge(new_label)
LabelsFinder.
new(current_user, title: new_label.title, group_id: project.group.id).
execute(skip_authorization: true).
where.not(id: new_label).
select(:id) # Can't use pluck() to avoid object-creation because of the batching
LabelsFinder
.new(current_user, title: new_label.title, group_id: project.group.id)
.execute(skip_authorization: true)
.where.not(id: new_label)
.select(:id) # Can't use pluck() to avoid object-creation because of the batching
end
 
def update_issuables(new_label, label_ids)
LabelLink.
where(label: label_ids).
update_all(label_id: new_label)
LabelLink
.where(label: label_ids)
.update_all(label_id: new_label)
end
 
def update_issue_board_lists(new_label, label_ids)
List.
where(label: label_ids).
update_all(label_id: new_label)
List
.where(label: label_ids)
.update_all(label_id: new_label)
end
 
def update_priorities(new_label, label_ids)
LabelPriority.
where(label: label_ids).
update_all(label_id: new_label)
LabelPriority
.where(label: label_ids)
.update_all(label_id: new_label)
end
 
def update_project_labels(label_ids)
Loading
Loading
Loading
Loading
@@ -41,16 +41,16 @@ module Labels
end
 
def group_labels_applied_to_issues
Label.joins(:issues).
where(
Label.joins(:issues)
.where(
issues: { project_id: project.id },
labels: { type: 'GroupLabel', group_id: old_group.id }
)
end
 
def group_labels_applied_to_merge_requests
Label.joins(:merge_requests).
where(
Label.joins(:merge_requests)
.where(
merge_requests: { target_project_id: project.id },
labels: { type: 'GroupLabel', group_id: old_group.id }
)
Loading
Loading
@@ -64,15 +64,15 @@ module Labels
end
 
def update_label_links(labels, old_label_id:, new_label_id:)
LabelLink.joins(:label).
merge(labels).
where(label_id: old_label_id).
update_all(label_id: new_label_id)
LabelLink.joins(:label)
.merge(labels)
.where(label_id: old_label_id)
.update_all(label_id: new_label_id)
end
 
def update_label_priorities(old_label_id:, new_label_id:)
LabelPriority.where(project_id: project.id, label_id: old_label_id).
update_all(label_id: new_label_id)
LabelPriority.where(project_id: project.id, label_id: old_label_id)
.update_all(label_id: new_label_id)
end
end
end
Loading
Loading
@@ -26,30 +26,30 @@ module Members
 
def unassign_issues_and_merge_requests(member)
if member.is_a?(GroupMember)
issues = Issue.unscoped.select(1).
joins(:project).
where('issues.id = issue_assignees.issue_id AND projects.namespace_id = ?', member.source_id)
issues = Issue.unscoped.select(1)
.joins(:project)
.where('issues.id = issue_assignees.issue_id AND projects.namespace_id = ?', member.source_id)
 
# DELETE FROM issue_assignees WHERE user_id = X AND EXISTS (...)
IssueAssignee.unscoped.
where('user_id = :user_id AND EXISTS (:sub)', user_id: member.user_id, sub: issues).
delete_all
IssueAssignee.unscoped
.where('user_id = :user_id AND EXISTS (:sub)', user_id: member.user_id, sub: issues)
.delete_all
 
MergeRequestsFinder.new(user, group_id: member.source_id, assignee_id: member.user_id).
execute.
update_all(assignee_id: nil)
MergeRequestsFinder.new(user, group_id: member.source_id, assignee_id: member.user_id)
.execute
.update_all(assignee_id: nil)
else
project = member.source
 
# SELECT 1 FROM issues WHERE issues.id = issue_assignees.issue_id AND issues.project_id = X
issues = Issue.unscoped.select(1).
where('issues.id = issue_assignees.issue_id').
where(project_id: project.id)
issues = Issue.unscoped.select(1)
.where('issues.id = issue_assignees.issue_id')
.where(project_id: project.id)
 
# DELETE FROM issue_assignees WHERE user_id = X AND EXISTS (...)
IssueAssignee.unscoped.
where('user_id = :user_id AND EXISTS (:sub)', user_id: member.user_id, sub: issues).
delete_all
IssueAssignee.unscoped
.where('user_id = :user_id AND EXISTS (:sub)', user_id: member.user_id, sub: issues)
.delete_all
 
project.merge_requests.opened.assigned_to(member.user).update_all(assignee_id: nil)
end
Loading
Loading
Loading
Loading
@@ -27,10 +27,10 @@ module MergeRequests
tree: merge_index.write_tree(rugged)
}
 
conflicts_for_resolution.
project.
repository.
resolve_conflicts(current_user, merge_request.source_branch, commit_params)
conflicts_for_resolution
.project
.repository
.resolve_conflicts(current_user, merge_request.source_branch, commit_params)
end
end
 
Loading
Loading
Loading
Loading
@@ -61,8 +61,8 @@ module MergeRequests
MergeRequests::PostMergeService.new(project, current_user).execute(merge_request)
 
if params[:should_remove_source_branch].present? || @merge_request.force_remove_source_branch?
DeleteBranchService.new(@merge_request.source_project, branch_deletion_user).
execute(merge_request.source_branch)
DeleteBranchService.new(@merge_request.source_project, branch_deletion_user)
.execute(merge_request.source_branch)
end
end
 
Loading
Loading
Loading
Loading
@@ -43,9 +43,9 @@ module MergeRequests
end
 
filter_merge_requests(merge_requests).each do |merge_request|
MergeRequests::PostMergeService.
new(merge_request.target_project, @current_user).
execute(merge_request)
MergeRequests::PostMergeService
.new(merge_request.target_project, @current_user)
.execute(merge_request)
end
end
 
Loading
Loading
@@ -56,8 +56,8 @@ module MergeRequests
# Refresh merge request diff if we push to source or target branch of merge request
# Note: we should update merge requests from forks too
def reload_merge_requests
merge_requests = @project.merge_requests.opened.
by_source_or_target_branch(@branch_name).to_a
merge_requests = @project.merge_requests.opened
.by_source_or_target_branch(@branch_name).to_a
 
# Fork merge requests
merge_requests += MergeRequest.opened
Loading
Loading
Loading
Loading
@@ -22,8 +22,8 @@ module Notes
def extract_commands(note, options = {})
return [note.note, {}] unless supported?(note)
 
QuickActions::InterpretService.new(project, current_user, options).
execute(note.note, note.noteable)
QuickActions::InterpretService.new(project, current_user, options)
.execute(note.note, note.noteable)
end
 
def execute(command_params, note)
Loading
Loading
Loading
Loading
@@ -19,8 +19,8 @@ module Tags
 
if new_tag
if release_description
CreateReleaseService.new(@project, @current_user).
execute(tag_name, release_description)
CreateReleaseService.new(@project, @current_user)
.execute(tag_name, release_description)
end
 
success.merge(tag: new_tag)
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ class MergeWorker
current_user = User.find(current_user_id)
merge_request = MergeRequest.find(merge_request_id)
 
MergeRequests::MergeService.new(merge_request.target_project, current_user, params).
execute(merge_request)
MergeRequests::MergeService.new(merge_request.target_project, current_user, params)
.execute(merge_request)
end
end
Loading
Loading
@@ -47,8 +47,8 @@ class ProcessCommitWorker
# therefor we use IssueCollection here and skip the authorization check in
# Issues::CloseService#execute.
IssueCollection.new(issues).updatable_by_user(user).each do |issue|
Issues::CloseService.new(project, author).
close_issue(issue, commit: commit)
Issues::CloseService.new(project, author)
.close_issue(issue, commit: commit)
end
end
 
Loading
Loading
@@ -57,8 +57,8 @@ class ProcessCommitWorker
 
return if mentioned_issues.empty?
 
Issue::Metrics.where(issue_id: mentioned_issues.map(&:id), first_mentioned_in_commit_at: nil).
update_all(first_mentioned_in_commit_at: commit.committed_date)
Issue::Metrics.where(issue_id: mentioned_issues.map(&:id), first_mentioned_in_commit_at: nil)
.update_all(first_mentioned_in_commit_at: commit.committed_date)
end
 
def build_commit(project, hash)
Loading
Loading
Loading
Loading
@@ -32,8 +32,8 @@ class ProjectCacheWorker
private
 
def try_obtain_lease_for(project_id, section)
Gitlab::ExclusiveLease.
new("project_cache_worker:#{project_id}:#{section}", timeout: LEASE_TIMEOUT).
try_obtain
Gitlab::ExclusiveLease
.new("project_cache_worker:#{project_id}:#{section}", timeout: LEASE_TIMEOUT)
.try_obtain
end
end
Loading
Loading
@@ -14,8 +14,8 @@ class PropagateServiceTemplateWorker
private
 
def try_obtain_lease_for(template_id)
Gitlab::ExclusiveLease.
new("propagate_service_template_worker:#{template_id}", timeout: LEASE_TIMEOUT).
try_obtain
Gitlab::ExclusiveLease
.new("propagate_service_template_worker:#{template_id}", timeout: LEASE_TIMEOUT)
.try_obtain
end
end
Loading
Loading
@@ -10,9 +10,9 @@ class PruneOldEventsWorker
'(id IN (SELECT id FROM (?) ids_to_remove))',
Event.unscoped.where(
'created_at < ?',
(12.months + 1.day).ago).
select(:id).
limit(10_000)).
delete_all
(12.months + 1.day).ago)
.select(:id)
.limit(10_000))
.delete_all
end
end
Loading
Loading
@@ -32,10 +32,10 @@ module RepositoryCheck
# has to sit and wait for this query to finish.
def project_ids
limit = 10_000
never_checked_projects = Project.where('last_repository_check_at IS NULL AND created_at < ?', 24.hours.ago).
limit(limit).pluck(:id)
old_check_projects = Project.where('last_repository_check_at < ?', 1.month.ago).
reorder('last_repository_check_at ASC').limit(limit).pluck(:id)
never_checked_projects = Project.where('last_repository_check_at IS NULL AND created_at < ?', 24.hours.ago)
.limit(limit).pluck(:id)
old_check_projects = Project.where('last_repository_check_at < ?', 1.month.ago)
.reorder('last_repository_check_at ASC').limit(limit).pluck(:id)
never_checked_projects + old_check_projects
end
 
Loading
Loading
Loading
Loading
@@ -7,8 +7,8 @@ class UpdateUserActivityWorker
ids = pairs.keys
conditions = 'WHEN id = ? THEN ? ' * ids.length
 
User.where(id: ids).
update_all([
User.where(id: ids)
.update_all([
"last_activity_on = CASE #{conditions} ELSE last_activity_on END",
*pairs.to_a.flatten
])
Loading
Loading
Loading
Loading
@@ -154,8 +154,8 @@ if Gitlab::Metrics.enabled?
ActiveRecord::Querying.public_instance_methods(false).map(&:to_s)
)
 
Gitlab::Metrics::Instrumentation.
instrument_class_hierarchy(ActiveRecord::Base) do |klass, method|
Gitlab::Metrics::Instrumentation
.instrument_class_hierarchy(ActiveRecord::Base) do |klass, method|
# Instrumenting the ApplicationSetting class can lead to an infinite
# loop. Since the data is cached any way we don't really need to
# instrument it.
Loading
Loading
Loading
Loading
@@ -6,9 +6,9 @@ class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration
 
class Project < ActiveRecord::Base
def self.find_including_path(id)
select("projects.*, CONCAT(namespaces.path, '/', projects.path) AS path_with_namespace").
joins('INNER JOIN namespaces ON namespaces.id = projects.namespace_id').
find_by(id: id)
select("projects.*, CONCAT(namespaces.path, '/', projects.path) AS path_with_namespace")
.joins('INNER JOIN namespaces ON namespaces.id = projects.namespace_id')
.find_by(id: id)
end
 
def repository_storage_path
Loading
Loading
Loading
Loading
@@ -8,11 +8,11 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration
environments = Arel::Table.new(:environments)
 
# Get all [project_id, name] pairs that occur more than once
finder_sql = environments.
group(environments[:project_id], environments[:name]).
having(Arel.sql("COUNT(1)").gt(1)).
project(environments[:project_id], environments[:name]).
to_sql
finder_sql = environments
.group(environments[:project_id], environments[:name])
.having(Arel.sql("COUNT(1)").gt(1))
.project(environments[:project_id], environments[:name])
.to_sql
 
conflicting = connection.exec_query(finder_sql)
 
Loading
Loading
@@ -28,12 +28,12 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration
# Rename conflicting environments by appending "-#{id}" to all but the first
def fix_duplicates(project_id, name)
environments = Arel::Table.new(:environments)
finder_sql = environments.
where(environments[:project_id].eq(project_id)).
where(environments[:name].eq(name)).
order(environments[:id].asc).
project(environments[:id], environments[:name]).
to_sql
finder_sql = environments
.where(environments[:project_id].eq(project_id))
.where(environments[:name].eq(name))
.order(environments[:id].asc)
.project(environments[:id], environments[:name])
.to_sql
 
# Now we have the data for all the conflicting rows
conflicts = connection.exec_query(finder_sql).rows
Loading
Loading
@@ -41,11 +41,11 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration
 
conflicts.each do |id, name|
update_sql =
Arel::UpdateManager.new(ActiveRecord::Base).
table(environments).
set(environments[:name] => name + "-" + id.to_s).
where(environments[:id].eq(id)).
to_sql
Arel::UpdateManager.new(ActiveRecord::Base)
.table(environments)
.set(environments[:name] => name + "-" + id.to_s)
.where(environments[:id].eq(id))
.to_sql
 
connection.exec_update(update_sql, self.class.name, [])
end
Loading
Loading
Loading
Loading
@@ -19,10 +19,10 @@ class AddEnvironmentSlug < ActiveRecord::Migration
finder = environments.project(:id, :name)
 
connection.exec_query(finder.to_sql).rows.each do |id, name|
updater = Arel::UpdateManager.new(ActiveRecord::Base).
table(environments).
set(environments[:slug] => generate_slug(name)).
where(environments[:id].eq(id))
updater = Arel::UpdateManager.new(ActiveRecord::Base)
.table(environments)
.set(environments[:slug] => generate_slug(name))
.where(environments[:id].eq(id))
 
connection.exec_update(updater.to_sql, self.class.name, [])
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment