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 93 additions and 93 deletions
Loading
Loading
@@ -23,15 +23,15 @@ module Ci
scope :ordered, ->() { order(id: :desc) }
 
scope :owned_or_shared, ->(project_id) do
joins('LEFT JOIN ci_runner_projects ON ci_runner_projects.runner_id = ci_runners.id')
.where("ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true", project_id: project_id)
joins('LEFT JOIN ci_runner_projects ON ci_runner_projects.runner_id = ci_runners.id').
where("ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true", project_id: project_id)
end
 
scope :assignable_for, ->(project) do
# FIXME: That `to_sql` is needed to workaround a weird Rails bug.
# Without that, placeholders would miss one and couldn't match.
where(locked: false)
.where.not("id IN (#{project.runners.select(:id).to_sql})").specific
where(locked: false).
where.not("id IN (#{project.runners.select(:id).to_sql})").specific
end
 
validate :tag_constraints
Loading
Loading
Loading
Loading
@@ -28,9 +28,9 @@ module Ci
end
 
def detailed_status(current_user)
Gitlab::Ci::Status::Stage::Factory
.new(self, current_user)
.fabricate!
Gitlab::Ci::Status::Stage::Factory.
new(self, current_user).
fabricate!
end
 
def statuses
Loading
Loading
Loading
Loading
@@ -97,8 +97,8 @@ class CommitStatus < ActiveRecord::Base
 
after_transition any => :failed do |commit_status|
commit_status.run_after_commit do
MergeRequests::AddTodoWhenBuildFailsService
.new(pipeline.project, nil).execute(self)
MergeRequests::AddTodoWhenBuildFailsService.
new(pipeline.project, nil).execute(self)
end
end
end
Loading
Loading
@@ -132,9 +132,9 @@ class CommitStatus < ActiveRecord::Base
end
 
def detailed_status(current_user)
Gitlab::Ci::Status::Factory
.new(self, current_user)
.fabricate!
Gitlab::Ci::Status::Factory.
new(self, current_user).
fabricate!
end
 
def sortable_name
Loading
Loading
Loading
Loading
@@ -162,9 +162,9 @@ module Issuable
 
highest_priority = highest_label_priority(params).to_sql
 
select("#{table_name}.*, (#{highest_priority}) AS highest_priority")
.group(arel_table[:id])
.reorder(Gitlab::Database.nulls_last_order('highest_priority', 'ASC'))
select("#{table_name}.*, (#{highest_priority}) AS highest_priority").
group(arel_table[:id]).
reorder(Gitlab::Database.nulls_last_order('highest_priority', 'ASC'))
end
 
def with_label(title, sort = nil)
Loading
Loading
Loading
Loading
@@ -48,8 +48,8 @@ module Mentionable
if extractor
@extractor = extractor
else
@extractor ||= Gitlab::ReferenceExtractor
.new(project, current_user)
@extractor ||= Gitlab::ReferenceExtractor.
new(project, current_user)
 
@extractor.reset_memoized_values
end
Loading
Loading
Loading
Loading
@@ -39,8 +39,8 @@ module Milestoneish
 
def issues_visible_to_user(user)
memoize_per_user(user, :issues_visible_to_user) do
IssuesFinder.new(user, issues_finder_params)
.execute.where(milestone_id: milestoneish_ids)
IssuesFinder.new(user, issues_finder_params).
execute.where(milestone_id: milestoneish_ids)
end
end
 
Loading
Loading
module Presentable
def present(**attributes)
Gitlab::View::Presenter::Factory
.new(self, attributes)
.fabricate!
Gitlab::View::Presenter::Factory.
new(self, attributes).
fabricate!
end
end
Loading
Loading
@@ -75,11 +75,11 @@ module Routable
#
# Returns an ActiveRecord::Relation.
def member_descendants(user_id)
joins(:route)
.joins("INNER JOIN routes r2 ON routes.path LIKE CONCAT(r2.path, '/%')
joins(:route).
joins("INNER JOIN routes r2 ON routes.path LIKE CONCAT(r2.path, '/%')
INNER JOIN members ON members.source_id = r2.source_id
AND members.source_type = r2.source_type")
.where('members.user_id = ?', user_id)
AND members.source_type = r2.source_type").
where('members.user_id = ?', user_id)
end
end
 
Loading
Loading
Loading
Loading
@@ -39,12 +39,12 @@ module Sortable
private
 
def highest_label_priority(target_type_column: nil, target_type: nil, target_column:, project_column:, excluded_labels: [])
query = Label.select(LabelPriority.arel_table[:priority].minimum)
.left_join_priorities
.joins(:label_links)
.where("label_priorities.project_id = #{project_column}")
.where("label_links.target_id = #{target_column}")
.reorder(nil)
query = Label.select(LabelPriority.arel_table[:priority].minimum).
left_join_priorities.
joins(:label_links).
where("label_priorities.project_id = #{project_column}").
where("label_links.target_id = #{target_column}").
reorder(nil)
 
query =
if target_type_column
Loading
Loading
Loading
Loading
@@ -27,30 +27,30 @@ module Subscribable
end
 
def subscribers(project)
subscriptions_available(project)
.where(subscribed: true)
.map(&:user)
subscriptions_available(project).
where(subscribed: true).
map(&:user)
end
 
def toggle_subscription(user, project = nil)
unsubscribe_from_other_levels(user, project)
 
find_or_initialize_subscription(user, project)
.update(subscribed: !subscribed?(user, project))
find_or_initialize_subscription(user, project).
update(subscribed: !subscribed?(user, project))
end
 
def subscribe(user, project = nil)
unsubscribe_from_other_levels(user, project)
 
find_or_initialize_subscription(user, project)
.update(subscribed: true)
find_or_initialize_subscription(user, project).
update(subscribed: true)
end
 
def unsubscribe(user, project = nil)
unsubscribe_from_other_levels(user, project)
 
find_or_initialize_subscription(user, project)
.update(subscribed: false)
find_or_initialize_subscription(user, project).
update(subscribed: false)
end
 
private
Loading
Loading
@@ -69,14 +69,14 @@ module Subscribable
end
 
def find_or_initialize_subscription(user, project)
subscriptions
.find_or_initialize_by(user_id: user.id, project_id: project.try(:id))
subscriptions.
find_or_initialize_by(user_id: user.id, project_id: project.try(:id))
end
 
def subscriptions_available(project)
t = Subscription.arel_table
 
subscriptions
.where(t[:project_id].eq(nil).or(t[:project_id].eq(project.try(:id))))
subscriptions.
where(t[:project_id].eq(nil).or(t[:project_id].eq(project.try(:id))))
end
end
Loading
Loading
@@ -53,10 +53,10 @@ class Deployment < ActiveRecord::Base
def update_merge_request_metrics!
return unless environment.update_merge_request_metrics?
 
merge_requests = project.merge_requests
.joins(:metrics)
.where(target_branch: self.ref, merge_request_metrics: { first_deployed_to_production_at: nil })
.where("merge_request_metrics.merged_at <= ?", self.created_at)
merge_requests = project.merge_requests.
joins(:metrics).
where(target_branch: self.ref, merge_request_metrics: { first_deployed_to_production_at: nil }).
where("merge_request_metrics.merged_at <= ?", self.created_at)
 
if previous_deployment
merge_requests = merge_requests.where("merge_request_metrics.merged_at >= ?", previous_deployment.created_at)
Loading
Loading
@@ -71,17 +71,17 @@ class Deployment < ActiveRecord::Base
merge_requests.map(&:id)
end
 
MergeRequest::Metrics
.where(merge_request_id: merge_request_ids, first_deployed_to_production_at: nil)
.update_all(first_deployed_to_production_at: self.created_at)
MergeRequest::Metrics.
where(merge_request_id: merge_request_ids, first_deployed_to_production_at: nil).
update_all(first_deployed_to_production_at: self.created_at)
end
 
def previous_deployment
@previous_deployment ||=
project.deployments.joins(:environment)
.where(environments: { name: self.environment.name }, ref: self.ref)
.where.not(id: self.id)
.take
project.deployments.joins(:environment).
where(environments: { name: self.environment.name }, ref: self.ref).
where.not(id: self.id).
take
end
 
def stop_action
Loading
Loading
Loading
Loading
@@ -40,9 +40,9 @@ class Environment < ActiveRecord::Base
scope :stopped, -> { with_state(:stopped) }
scope :order_by_last_deployed_at, -> do
max_deployment_id_sql =
Deployment.select(Deployment.arel_table[:id].maximum)
.where(Deployment.arel_table[:environment_id].eq(arel_table[:id]))
.to_sql
Deployment.select(Deployment.arel_table[:id].maximum).
where(Deployment.arel_table[:environment_id].eq(arel_table[:id])).
to_sql
order(Gitlab::Database.nulls_first_order("(#{max_deployment_id_sql})", 'ASC'))
end
 
Loading
Loading
Loading
Loading
@@ -343,9 +343,9 @@ class Event < ActiveRecord::Base
# At this point it's possible for multiple threads/processes to try to
# update the project. Only one query should actually perform the update,
# hence we add the extra WHERE clause for last_activity_at.
Project.unscoped.where(id: project_id)
.where('last_activity_at <= ?', RESET_PROJECT_ACTIVITY_INTERVAL.ago)
.update_all(last_activity_at: created_at)
Project.unscoped.where(id: project_id).
where('last_activity_at <= ?', RESET_PROJECT_ACTIVITY_INTERVAL.ago).
update_all(last_activity_at: created_at)
end
 
def authored_by?(user)
Loading
Loading
Loading
Loading
@@ -18,8 +18,8 @@ class GenericCommitStatus < CommitStatus
end
 
def detailed_status(current_user)
Gitlab::Ci::Status::External::Factory
.new(self, current_user)
.fabricate!
Gitlab::Ci::Status::External::Factory.
new(self, current_user).
fabricate!
end
end
Loading
Loading
@@ -76,8 +76,8 @@ class GlobalMilestone
end
 
def labels
@labels ||= GlobalLabel.build_collection(milestones.includes(:labels).map(&:labels).flatten)
.sort_by!(&:title)
@labels ||= GlobalLabel.build_collection(milestones.includes(:labels).map(&:labels).flatten).
sort_by!(&:title)
end
 
def due_date
Loading
Loading
Loading
Loading
@@ -71,9 +71,9 @@ class Group < Namespace
 
def select_for_project_authorization
if current_scope.joins_values.include?(:shared_projects)
joins('INNER JOIN namespaces project_namespace ON project_namespace.id = projects.namespace_id')
.where('project_namespace.share_with_group_lock = ?', false)
.select("members.user_id, projects.id AS project_id, LEAST(project_group_links.group_access, members.access_level) AS access_level")
joins('INNER JOIN namespaces project_namespace ON project_namespace.id = projects.namespace_id').
where('project_namespace.share_with_group_lock = ?', false).
select("members.user_id, projects.id AS project_id, LEAST(project_group_links.group_access, members.access_level) AS access_level")
else
super
end
Loading
Loading
@@ -197,8 +197,8 @@ class Group < Namespace
end
 
def refresh_members_authorized_projects
UserProjectAccessChangedService.new(user_ids_for_project_authorizations)
.execute
UserProjectAccessChangedService.new(user_ids_for_project_authorizations).
execute
end
 
def user_ids_for_project_authorizations
Loading
Loading
Loading
Loading
@@ -17,9 +17,9 @@ class IssueCollection
 
# Given all the issue projects we get a list of projects that the current
# user has at least reporter access to.
projects_with_reporter_access = user
.projects_with_reporter_access_limited_to(project_ids)
.pluck(:id)
projects_with_reporter_access = user.
projects_with_reporter_access_limited_to(project_ids).
pluck(:id)
 
collection.select do |issue|
if projects_with_reporter_access.include?(issue.project_id)
Loading
Loading
Loading
Loading
@@ -34,18 +34,18 @@ class Label < ActiveRecord::Base
scope :with_title, ->(title) { where(title: title) }
 
def self.prioritized(project)
joins(:priorities)
.where(label_priorities: { project_id: project })
.reorder('label_priorities.priority ASC, labels.title ASC')
joins(:priorities).
where(label_priorities: { project_id: project }).
reorder('label_priorities.priority ASC, labels.title ASC')
end
 
def self.unprioritized(project)
labels = Label.arel_table
priorities = LabelPriority.arel_table
 
label_priorities = labels.join(priorities, Arel::Nodes::OuterJoin)
.on(labels[:id].eq(priorities[:label_id]).and(priorities[:project_id].eq(project.id)))
.join_sources
label_priorities = labels.join(priorities, Arel::Nodes::OuterJoin).
on(labels[:id].eq(priorities[:label_id]).and(priorities[:project_id].eq(project.id))).
join_sources
 
joins(label_priorities).where(priorities[:priority].eq(nil))
end
Loading
Loading
@@ -54,9 +54,9 @@ class Label < ActiveRecord::Base
labels = Label.arel_table
priorities = LabelPriority.arel_table
 
label_priorities = labels.join(priorities, Arel::Nodes::OuterJoin)
.on(labels[:id].eq(priorities[:label_id]))
.join_sources
label_priorities = labels.join(priorities, Arel::Nodes::OuterJoin).
on(labels[:id].eq(priorities[:label_id])).
join_sources
 
joins(label_priorities)
end
Loading
Loading
Loading
Loading
@@ -19,8 +19,8 @@ class LfsObject < ActiveRecord::Base
end
 
def self.destroy_unreferenced
joins("LEFT JOIN lfs_objects_projects ON lfs_objects_projects.lfs_object_id = #{table_name}.id")
.where(lfs_objects_projects: { id: nil })
.destroy_all
joins("LEFT JOIN lfs_objects_projects ON lfs_objects_projects.lfs_object_id = #{table_name}.id").
where(lfs_objects_projects: { id: nil }).
destroy_all
end
end
Loading
Loading
@@ -41,9 +41,9 @@ class Member < ActiveRecord::Base
is_external_invite = arel_table[:user_id].eq(nil).and(arel_table[:invite_token].not_eq(nil))
user_is_active = User.arel_table[:state].eq(:active)
 
includes(:user).references(:users)
.where(is_external_invite.or(user_is_active))
.where(requested_at: nil)
includes(:user).references(:users).
where(is_external_invite.or(user_is_active)).
where(requested_at: nil)
end
 
scope :invite, -> { where.not(invite_token: nil) }
Loading
Loading
@@ -99,9 +99,9 @@ class Member < ActiveRecord::Base
users = User.arel_table
members = Member.arel_table
 
member_users = members.join(users, Arel::Nodes::OuterJoin)
.on(members[:user_id].eq(users[:id]))
.join_sources
member_users = members.join(users, Arel::Nodes::OuterJoin).
on(members[:user_id].eq(users[:id])).
join_sources
 
joins(member_users)
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