Skip to content
Snippets Groups Projects
Commit 1fe7501b authored by Douwe Maan's avatar Douwe Maan
Browse files

Revert "Prefer leading style for Style/DotPosition"

This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
parent bdbc7d96
No related branches found
No related tags found
No related merge requests found
Showing
with 116 additions and 116 deletions
Loading
Loading
@@ -475,10 +475,10 @@ class MergeRequest < ActiveRecord::Base
end
 
def discussions
@discussions ||= self.related_notes
.inc_relations_for_view
.fresh
.discussions
@discussions ||= self.related_notes.
inc_relations_for_view.
fresh.
discussions
end
 
def diff_discussions
Loading
Loading
@@ -564,8 +564,8 @@ class MergeRequest < ActiveRecord::Base
messages = [title, description]
messages.concat(commits.map(&:safe_message)) if merge_request_diff
 
Gitlab::ClosingIssueExtractor.new(project, current_user)
.closed_by_message(messages.join("\n"))
Gitlab::ClosingIssueExtractor.new(project, current_user).
closed_by_message(messages.join("\n"))
else
[]
end
Loading
Loading
@@ -813,9 +813,9 @@ class MergeRequest < ActiveRecord::Base
def all_pipelines
return Ci::Pipeline.none unless source_project
 
@all_pipelines ||= source_project.pipelines
.where(sha: all_commits_sha, ref: source_branch)
.order(id: :desc)
@all_pipelines ||= source_project.pipelines.
where(sha: all_commits_sha, ref: source_branch).
order(id: :desc)
end
 
# Note that this could also return SHA from now dangling commits
Loading
Loading
Loading
Loading
@@ -169,8 +169,8 @@ class MergeRequestDiff < ActiveRecord::Base
# When compare merge request versions we want diff A..B instead of A...B
# so we handle cases when user does squash and rebase of the commits between versions.
# For this reason we set straight to true by default.
CompareService.new(project, head_commit_sha)
.execute(project, sha, straight: straight)
CompareService.new(project, head_commit_sha).
execute(project, sha, straight: straight)
end
 
def commits_count
Loading
Loading
Loading
Loading
@@ -7,9 +7,9 @@ class MergeRequestsClosingIssues < ActiveRecord::Base
 
class << self
def count_for_collection(ids)
group(:issue_id)
.where(issue_id: ids)
.pluck('issue_id', 'COUNT(*) as count')
group(:issue_id).
where(issue_id: ids).
pluck('issue_id', 'COUNT(*) as count')
end
end
end
Loading
Loading
@@ -98,11 +98,11 @@ class Milestone < ActiveRecord::Base
if Gitlab::Database.postgresql?
rel.order(:project_id, :due_date).select('DISTINCT ON (project_id) id')
else
rel
.group(:project_id)
.having('due_date = MIN(due_date)')
.pluck(:id, :project_id, :due_date)
.map(&:first)
rel.
group(:project_id).
having('due_date = MIN(due_date)').
pluck(:id, :project_id, :due_date).
map(&:first)
end
end
 
Loading
Loading
@@ -177,8 +177,8 @@ class Milestone < ActiveRecord::Base
 
conditions = 'WHEN id = ? THEN ? ' * ids.length
 
issues.where(id: ids)
.update_all(["position = CASE #{conditions} ELSE position END", *pairs])
issues.where(id: ids).
update_all(["position = CASE #{conditions} ELSE position END", *pairs])
end
 
private
Loading
Loading
Loading
Loading
@@ -48,9 +48,9 @@ class Namespace < ActiveRecord::Base
scope :root, -> { where('type IS NULL') }
 
scope :with_statistics, -> do
joins('LEFT JOIN project_statistics ps ON ps.namespace_id = namespaces.id')
.group('namespaces.id')
.select(
joins('LEFT JOIN project_statistics ps ON ps.namespace_id = namespaces.id').
group('namespaces.id').
select(
'namespaces.*',
'COALESCE(SUM(ps.storage_size), 0) AS storage_size',
'COALESCE(SUM(ps.repository_size), 0) AS repository_size',
Loading
Loading
@@ -251,10 +251,10 @@ class Namespace < ActiveRecord::Base
end
 
def refresh_access_of_projects_invited_groups
Group
.joins(project_group_links: :project)
.where(projects: { namespace_id: id })
.find_each(&:refresh_members_authorized_projects)
Group.
joins(project_group_links: :project).
where(projects: { namespace_id: id }).
find_each(&:refresh_members_authorized_projects)
end
 
def remove_exports!
Loading
Loading
Loading
Loading
@@ -28,8 +28,8 @@ module Network
if map.include?(p.id)
map[p.id]
end
end
.compact
end.
compact
end
end
end
Loading
Loading
@@ -23,12 +23,12 @@ module Network
def collect_notes
h = Hash.new(0)
 
@project
.notes
.where('noteable_type = ?', 'Commit')
.group('notes.commit_id')
.select('notes.commit_id, count(notes.id) as note_count')
.each do |item|
@project.
notes.
where('noteable_type = ?', 'Commit').
group('notes.commit_id').
select('notes.commit_id, count(notes.id) as note_count').
each do |item|
h[item.commit_id] = item.note_count.to_i
end
 
Loading
Loading
Loading
Loading
@@ -105,14 +105,14 @@ class Note < ActiveRecord::Base
 
def grouped_diff_discussions
active_notes = diff_notes.fresh.select(&:active?)
Discussion.for_diff_notes(active_notes)
.map { |d| [d.line_code, d] }.to_h
Discussion.for_diff_notes(active_notes).
map { |d| [d.line_code, d] }.to_h
end
 
def count_for_collection(ids, type)
user.select('noteable_id', 'COUNT(*) as count')
.group(:noteable_id)
.where(noteable_type: type, noteable_id: ids)
user.select('noteable_id', 'COUNT(*) as count').
group(:noteable_id).
where(noteable_type: type, noteable_id: ids)
end
end
 
Loading
Loading
Loading
Loading
@@ -235,8 +235,8 @@ class Project < ActiveRecord::Base
scope :inside_path, ->(path) do
# We need routes alias rs for JOIN so it does not conflict with
# includes(:route) which we use in ProjectsFinder.
joins("INNER JOIN routes rs ON rs.source_id = projects.id AND rs.source_type = 'Project'")
.where('rs.path LIKE ?', "#{path}/%")
joins("INNER JOIN routes rs ON rs.source_id = projects.id AND rs.source_type = 'Project'").
where('rs.path LIKE ?', "#{path}/%")
end
 
# "enabled" here means "not disabled". It includes private features!
Loading
Loading
@@ -313,9 +313,9 @@ class Project < ActiveRecord::Base
pattern = "%#{query}%"
 
projects = select(:id).where(
ptable[:path].matches(pattern)
.or(ptable[:name].matches(pattern))
.or(ptable[:description].matches(pattern))
ptable[:path].matches(pattern).
or(ptable[:name].matches(pattern)).
or(ptable[:description].matches(pattern))
)
 
# We explicitly remove any eager loading clauses as they're:
Loading
Loading
@@ -324,10 +324,10 @@ class Project < ActiveRecord::Base
# 2. Combined with .joins(:namespace) lead to all columns from the
# projects & namespaces tables being selected, leading to a SQL error
# due to the columns of all UNION'd queries no longer being the same.
namespaces = select(:id)
.except(:includes)
.joins(:namespace)
.where(ntable[:name].matches(pattern))
namespaces = select(:id).
except(:includes).
joins(:namespace).
where(ntable[:name].matches(pattern))
 
union = Gitlab::SQL::Union.new([projects, namespaces])
 
Loading
Loading
@@ -369,8 +369,8 @@ class Project < ActiveRecord::Base
end
 
def trending
joins('INNER JOIN trending_projects ON projects.id = trending_projects.project_id')
.reorder('trending_projects.id ASC')
joins('INNER JOIN trending_projects ON projects.id = trending_projects.project_id').
reorder('trending_projects.id ASC')
end
 
def cached_count
Loading
Loading
Loading
Loading
@@ -105,9 +105,9 @@ class KubernetesService < DeploymentService
def terminals(environment)
with_reactive_cache do |data|
pods = data.fetch(:pods, nil)
filter_pods(pods, app: environment.slug)
.flat_map { |pod| terminals_for_pod(api_url, namespace, pod) }
.each { |terminal| add_terminal_auth(terminal, terminal_auth) }
filter_pods(pods, app: environment.slug).
flat_map { |pod| terminals_for_pod(api_url, namespace, pod) }.
each { |terminal| add_terminal_auth(terminal, terminal_auth) }
end
end
 
Loading
Loading
Loading
Loading
@@ -20,8 +20,8 @@ class MattermostSlashCommandsService < ChatSlashCommandsService
end
 
def configure(user, params)
token = Mattermost::Command.new(user)
.create(command(params))
token = Mattermost::Command.new(user).
create(command(params))
 
update(active: true, token: token) if token
rescue Mattermost::Error => e
Loading
Loading
Loading
Loading
@@ -169,10 +169,10 @@ class ProjectTeam
 
# Lookup only the IDs we need
user_ids = user_ids - access.keys
users_access = project.project_authorizations
.where(user: user_ids)
.group(:user_id)
.maximum(:access_level)
users_access = project.project_authorizations.
where(user: user_ids).
group(:user_id).
maximum(:access_level)
 
access.merge!(users_access)
access
Loading
Loading
Loading
Loading
@@ -249,11 +249,11 @@ class Repository
cache.fetch(:"diverging_commit_counts_#{branch.name}") do
# Rugged seems to throw a `ReferenceError` when given branch_names rather
# than SHA-1 hashes
number_commits_behind = raw_repository
.count_commits_between(branch.dereferenced_target.sha, root_ref_hash)
number_commits_behind = raw_repository.
count_commits_between(branch.dereferenced_target.sha, root_ref_hash)
 
number_commits_ahead = raw_repository
.count_commits_between(root_ref_hash, branch.dereferenced_target.sha)
number_commits_ahead = raw_repository.
count_commits_between(root_ref_hash, branch.dereferenced_target.sha)
 
{ behind: number_commits_behind, ahead: number_commits_ahead }
end
Loading
Loading
@@ -755,8 +755,8 @@ class Repository
check_tree_entry_for_dir(branch_name, path)
 
if start_branch_name
start_project.repository
.check_tree_entry_for_dir(start_branch_name, path)
start_project.repository.
check_tree_entry_for_dir(start_branch_name, path)
end
 
commit_file(
Loading
Loading
Loading
Loading
@@ -64,9 +64,9 @@ class Todo < ActiveRecord::Base
 
highest_priority = highest_label_priority(params).to_sql
 
select("#{table_name}.*, (#{highest_priority}) AS highest_priority")
.order(Gitlab::Database.nulls_last_order('highest_priority', 'ASC'))
.order('todos.created_at')
select("#{table_name}.*, (#{highest_priority}) AS highest_priority").
order(Gitlab::Database.nulls_last_order('highest_priority', 'ASC')).
order('todos.created_at')
end
end
 
Loading
Loading
Loading
Loading
@@ -197,13 +197,13 @@ class User < ActiveRecord::Base
scope :order_oldest_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('last_sign_in_at', 'ASC')) }
 
def self.with_two_factor
joins("LEFT OUTER JOIN u2f_registrations AS u2f ON u2f.user_id = users.id")
.where("u2f.id IS NOT NULL OR otp_required_for_login = ?", true).distinct(arel_table[:id])
joins("LEFT OUTER JOIN u2f_registrations AS u2f ON u2f.user_id = users.id").
where("u2f.id IS NOT NULL OR otp_required_for_login = ?", true).distinct(arel_table[:id])
end
 
def self.without_two_factor
joins("LEFT OUTER JOIN u2f_registrations AS u2f ON u2f.user_id = users.id")
.where("u2f.id IS NULL AND otp_required_for_login = ?", false)
joins("LEFT OUTER JOIN u2f_registrations AS u2f ON u2f.user_id = users.id").
where("u2f.id IS NULL AND otp_required_for_login = ?", false)
end
 
#
Loading
Loading
@@ -274,9 +274,9 @@ class User < ActiveRecord::Base
pattern = "%#{query}%"
 
where(
table[:name].matches(pattern)
.or(table[:email].matches(pattern))
.or(table[:username].matches(pattern))
table[:name].matches(pattern).
or(table[:email].matches(pattern)).
or(table[:username].matches(pattern))
)
end
 
Loading
Loading
@@ -291,10 +291,10 @@ class User < ActiveRecord::Base
matched_by_emails_user_ids = email_table.project(email_table[:user_id]).where(email_table[:email].matches(pattern))
 
where(
table[:name].matches(pattern)
.or(table[:email].matches(pattern))
.or(table[:username].matches(pattern))
.or(table[:id].in(matched_by_emails_user_ids))
table[:name].matches(pattern).
or(table[:email].matches(pattern)).
or(table[:username].matches(pattern)).
or(table[:id].in(matched_by_emails_user_ids))
)
end
 
Loading
Loading
@@ -447,8 +447,8 @@ class User < ActiveRecord::Base
 
# Returns the groups a user has access to
def authorized_groups
union = Gitlab::SQL::Union
.new([groups.select(:id), authorized_projects.select(:namespace_id)])
union = Gitlab::SQL::Union.
new([groups.select(:id), authorized_projects.select(:namespace_id)])
 
Group.where("namespaces.id IN (#{union.to_sql})")
end
Loading
Loading
@@ -458,8 +458,8 @@ class User < ActiveRecord::Base
end
 
def nested_projects
Project.joins(:namespace).where('namespaces.parent_id IS NOT NULL')
.member_descendants(id)
Project.joins(:namespace).where('namespaces.parent_id IS NOT NULL').
member_descendants(id)
end
 
def refresh_authorized_projects
Loading
Loading
@@ -579,9 +579,9 @@ class User < ActiveRecord::Base
next unless project
 
if project.repository.branch_exists?(event.branch_name)
merge_requests = MergeRequest.where("created_at >= ?", event.created_at)
.where(source_project_id: project.id,
source_branch: event.branch_name)
merge_requests = MergeRequest.where("created_at >= ?", event.created_at).
where(source_project_id: project.id,
source_branch: event.branch_name)
merge_requests.empty?
end
end
Loading
Loading
@@ -793,8 +793,8 @@ class User < ActiveRecord::Base
 
def toggle_star(project)
UsersStarProject.transaction do
user_star_project = users_star_projects
.where(project: project, user: self).lock(true).first
user_star_project = users_star_projects.
where(project: project, user: self).lock(true).first
 
if user_star_project
user_star_project.destroy
Loading
Loading
@@ -830,11 +830,11 @@ class User < ActiveRecord::Base
# ms on a database with a similar size to GitLab.com's database. On the other
# hand, using a subquery means we can get the exact same data in about 40 ms.
def contributed_projects
events = Event.select(:project_id)
.contributions.where(author_id: self)
.where("created_at > ?", Time.now - 1.year)
.uniq
.reorder(nil)
events = Event.select(:project_id).
contributions.where(author_id: self).
where("created_at > ?", Time.now - 1.year).
uniq.
reorder(nil)
 
Project.where(id: events)
end
Loading
Loading
@@ -845,9 +845,9 @@ class User < ActiveRecord::Base
 
def ci_authorized_runners
@ci_authorized_runners ||= begin
runner_ids = Ci::RunnerProject
.where("ci_runner_projects.gl_project_id IN (#{ci_projects_union.to_sql})")
.select(:runner_id)
runner_ids = Ci::RunnerProject.
where("ci_runner_projects.gl_project_id IN (#{ci_projects_union.to_sql})").
select(:runner_id)
Ci::Runner.specific.where(id: runner_ids)
end
end
Loading
Loading
Loading
Loading
@@ -22,16 +22,16 @@ class WikiPage
def self.group_by_directory(pages)
return [] if pages.blank?
 
pages.sort_by { |page| [page.directory, page.slug] }
.group_by(&:directory)
.map do |dir, pages|
pages.sort_by { |page| [page.directory, page.slug] }.
group_by(&:directory).
map do |dir, pages|
if dir.present?
WikiDirectory.new(dir, pages)
else
pages
end
end
.flatten
end.
flatten
end
 
def self.unhyphenize(name)
Loading
Loading
Loading
Loading
@@ -4,9 +4,9 @@ class BaseSerializer
end
 
def represent(resource, opts = {})
self.class.entity_class
.represent(resource, opts.merge(request: @request))
.as_json
self.class.entity_class.
represent(resource, opts.merge(request: @request)).
as_json
end
 
def self.entity(entity_class)
Loading
Loading
Loading
Loading
@@ -36,9 +36,9 @@ class EnvironmentSerializer < BaseSerializer
private
 
def itemize(resource)
items = resource.order('folder_name ASC')
.group('COALESCE(environment_type, name)')
.select('COALESCE(environment_type, name) AS folder_name',
items = resource.order('folder_name ASC').
group('COALESCE(environment_type, name)').
select('COALESCE(environment_type, name) AS folder_name',
'COUNT(*) AS size', 'MAX(id) AS last_id')
 
# It makes a difference when you call `paginate` method, because
Loading
Loading
Loading
Loading
@@ -14,8 +14,8 @@ class AfterBranchDeleteService < BaseService
private
 
def stop_environments
Ci::StopEnvironmentsService
.new(project, current_user)
.execute(branch_name)
Ci::StopEnvironmentsService.
new(project, current_user).
execute(branch_name)
end
end
Loading
Loading
@@ -57,15 +57,15 @@ module Boards
return issues unless board_label_ids.any?
 
issues.where.not(
LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id")
.where(label_id: board_label_ids).limit(1).arel.exists
LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id").
where(label_id: board_label_ids).limit(1).arel.exists
)
end
 
def with_list_label(issues)
issues.where(
LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id")
.where("label_links.label_id = ?", list.label_id).limit(1).arel.exists
LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id").
where("label_links.label_id = ?", list.label_id).limit(1).arel.exists
)
end
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