diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-02-21 17:29:35 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-23 09:31:56 -0600 |
commit | 3dadf306ddc81183e74b048bc4119796852ed7ea (patch) | |
tree | f01d5e7eb9c5550bc34a42d9e88479cd3fef578d /app | |
parent | 547063b3ac096dff25309b6e0846b0d5f417c128 (diff) | |
download | gitlab-ce-3dadf306ddc81183e74b048bc4119796852ed7ea.tar.gz |
Enable Style/DotPosition
Diffstat (limited to 'app')
57 files changed, 229 insertions, 229 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index b0f5d4a9933..f801fac1839 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -5,9 +5,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController end def update - successful = ApplicationSettings::UpdateService - .new(@application_setting, current_user, application_setting_params) - .execute + successful = ApplicationSettings::UpdateService. + new(@application_setting, current_user, application_setting_params). + execute if successful redirect_to admin_application_settings_path, diff --git a/app/controllers/concerns/issues_action.rb b/app/controllers/concerns/issues_action.rb index b17c138d5c7..8b985b6d003 100644 --- a/app/controllers/concerns/issues_action.rb +++ b/app/controllers/concerns/issues_action.rb @@ -5,9 +5,9 @@ module IssuesAction def issues @label = issues_finder.labels.first - @issues = issues_collection - .non_archived - .page(params[:page]) + @issues = issues_collection. + non_archived. + page(params[:page]) @collection_type = "Issue" @issuable_meta_data = issuable_meta_data(@issues, @collection_type) diff --git a/app/controllers/concerns/merge_requests_action.rb b/app/controllers/concerns/merge_requests_action.rb index d3c8e4888bc..28e34cffc24 100644 --- a/app/controllers/concerns/merge_requests_action.rb +++ b/app/controllers/concerns/merge_requests_action.rb @@ -5,8 +5,8 @@ module MergeRequestsAction def merge_requests @label = merge_requests_finder.labels.first - @merge_requests = merge_requests_collection - .page(params[:page]) + @merge_requests = merge_requests_collection. + page(params[:page]) @collection_type = "MergeRequest" @issuable_meta_data = issuable_meta_data(@merge_requests, @collection_type) diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb index 8e42cdf415f..cd5cef2c20f 100644 --- a/app/controllers/import/bitbucket_controller.rb +++ b/app/controllers/import/bitbucket_controller.rb @@ -29,9 +29,9 @@ class Import::BitbucketController < Import::BaseController end def jobs - render json: current_user.created_projects - .where(import_type: 'bitbucket') - .to_json(only: [:id, :import_status]) + render json: current_user.created_projects. + where(import_type: 'bitbucket'). + to_json(only: [:id, :import_status]) end def create diff --git a/app/controllers/projects/badges_controller.rb b/app/controllers/projects/badges_controller.rb index 6c25cd83a24..c1727d9fa28 100644 --- a/app/controllers/projects/badges_controller.rb +++ b/app/controllers/projects/badges_controller.rb @@ -4,15 +4,15 @@ class Projects::BadgesController < Projects::ApplicationController before_action :no_cache_headers, except: [:index] def build - build_status = Gitlab::Badge::Build::Status - .new(project, params[:ref]) + build_status = Gitlab::Badge::Build::Status. + new(project, params[:ref]) render_badge build_status end def coverage - coverage_report = Gitlab::Badge::Coverage::Report - .new(project, params[:ref], params[:job]) + coverage_report = Gitlab::Badge::Coverage::Report. + new(project, params[:ref], params[:job]) render_badge coverage_report end diff --git a/app/controllers/projects/boards/issues_controller.rb b/app/controllers/projects/boards/issues_controller.rb index 61fef4dc133..8bcf18642cf 100644 --- a/app/controllers/projects/boards/issues_controller.rb +++ b/app/controllers/projects/boards/issues_controller.rb @@ -40,10 +40,10 @@ module Projects def issue @issue ||= - IssuesFinder.new(current_user, project_id: project.id) - .execute - .where(iid: params[:id]) - .first! + IssuesFinder.new(current_user, project_id: project.id). + execute. + where(iid: params[:id]). + first! end def authorize_read_issue! diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index e10d7992db7..23466dda981 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -35,9 +35,9 @@ class Projects::CommitController < Projects::ApplicationController respond_to do |format| format.html format.json do - render json: PipelineSerializer - .new(project: @project, user: @current_user) - .represent(@pipelines) + render json: PipelineSerializer. + new(project: @project, user: @current_user). + represent(@pipelines) end end end diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index c6651254d70..99204c82784 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -46,8 +46,8 @@ class Projects::CompareController < Projects::ApplicationController end def define_diff_vars - @compare = CompareService.new(@project, @head_ref) - .execute(@project, @start_ref) + @compare = CompareService.new(@project, @head_ref). + execute(@project, @start_ref) if @compare @commits = @compare.commits diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index fed75396d6e..2bbd8c6d046 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -9,18 +9,18 @@ class Projects::EnvironmentsController < Projects::ApplicationController before_action :verify_api_request!, only: :terminal_websocket_authorize def index - @environments = project.environments - .with_state(params[:scope] || :available) + @environments = project.environments. + with_state(params[:scope] || :available) respond_to do |format| format.html format.json do render json: { - environments: EnvironmentSerializer - .new(project: @project, user: @current_user) - .with_pagination(request, response) - .within_folders - .represent(@environments), + environments: EnvironmentSerializer. + new(project: @project, user: @current_user). + with_pagination(request, response). + within_folders. + represent(@environments), available_count: project.environments.available.count, stopped_count: project.environments.stopped.count } @@ -36,10 +36,10 @@ class Projects::EnvironmentsController < Projects::ApplicationController format.html format.json do render json: { - environments: EnvironmentSerializer - .new(project: @project, user: @current_user) - .with_pagination(request, response) - .represent(@environments), + environments: EnvironmentSerializer. + new(project: @project, user: @current_user). + with_pagination(request, response). + represent(@environments), available_count: folder_environments.available.count, stopped_count: folder_environments.stopped.count } diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 365c49a20d4..c0c71c11dc2 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -232,9 +232,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController end format.json do - render json: PipelineSerializer - .new(project: @project, user: @current_user) - .represent(@pipelines) + render json: PipelineSerializer. + new(project: @project, user: @current_user). + represent(@pipelines) end end end @@ -245,9 +245,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController format.json do define_pipelines_vars - render json: PipelineSerializer - .new(project: @project, user: @current_user) - .represent(@pipelines) + render json: PipelineSerializer. + new(project: @project, user: @current_user). + represent(@pipelines) end end end @@ -332,9 +332,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController return access_denied! end - MergeRequests::MergeWhenPipelineSucceedsService - .new(@project, current_user) - .cancel(@merge_request) + MergeRequests::MergeWhenPipelineSucceedsService. + new(@project, current_user). + cancel(@merge_request) end def merge @@ -361,9 +361,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController end if @merge_request.head_pipeline.active? - MergeRequests::MergeWhenPipelineSucceedsService - .new(@project, current_user, merge_params) - .execute(@merge_request) + MergeRequests::MergeWhenPipelineSucceedsService. + new(@project, current_user, merge_params). + execute(@merge_request) @status = :merge_when_build_succeeds elsif @merge_request.head_pipeline.success? @@ -639,8 +639,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController end def merge_request_params - params.require(:merge_request) - .permit(merge_request_params_ce) + params.require(:merge_request). + permit(merge_request_params_ce) end def merge_request_params_ce diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index 8657bc4dfdc..0f2b7b2a4c8 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -7,32 +7,32 @@ class Projects::PipelinesController < Projects::ApplicationController def index @scope = params[:scope] - @pipelines = PipelinesFinder - .new(project) - .execute(scope: @scope) - .page(params[:page]) - .per(30) + @pipelines = PipelinesFinder. + new(project). + execute(scope: @scope). + page(params[:page]). + per(30) - @running_count = PipelinesFinder + @running_count = PipelinesFinder. .new(project).execute(scope: 'running').count - @pending_count = PipelinesFinder + @pending_count = PipelinesFinder. .new(project).execute(scope: 'pending').count - @finished_count = PipelinesFinder + @finished_count = PipelinesFinder. .new(project).execute(scope: 'finished').count - @pipelines_count = PipelinesFinder + @pipelines_count = PipelinesFinder. .new(project).execute.count respond_to do |format| format.html format.json do render json: { - pipelines: PipelineSerializer - .new(project: @project, user: @current_user) - .with_pagination(request, response) - .represent(@pipelines), + pipelines: PipelineSerializer. + new(project: @project, user: @current_user). + with_pagination(request, response). + represent(@pipelines), count: { all: @pipelines_count, running: @running_count, @@ -49,9 +49,9 @@ class Projects::PipelinesController < Projects::ApplicationController end def create - @pipeline = Ci::CreatePipelineService - .new(project, current_user, create_params) - .execute(ignore_skip_ci: true, save_on_errors: false) + @pipeline = Ci::CreatePipelineService. + new(project, current_user, create_params). + execute(ignore_skip_ci: true, save_on_errors: false) unless @pipeline.persisted? render 'new' return diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index acca821782c..9ffb8152e32 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -293,8 +293,8 @@ class ProjectsController < Projects::ApplicationController end def project_params - params.require(:project) - .permit(project_params_ce) + params.require(:project). + permit(project_params_ce) end def project_params_ce diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6e29f1e8a65..c92594d4097 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -118,8 +118,8 @@ class UsersController < ApplicationController def load_projects @projects = - PersonalProjectsFinder.new(user).execute(current_user) - .page(params[:page]) + PersonalProjectsFinder.new(user).execute(current_user). + page(params[:page]) end def load_contributed_projects diff --git a/app/finders/environments_finder.rb b/app/finders/environments_finder.rb index a59f8c1efa3..52c73abc31d 100644 --- a/app/finders/environments_finder.rb +++ b/app/finders/environments_finder.rb @@ -17,12 +17,12 @@ class EnvironmentsFinder deployments.none end - environment_ids = deployments - .group(:environment_id) - .select(:environment_id) + environment_ids = deployments. + group(:environment_id). + select(:environment_id) - environments = project.environments.available - .where(id: environment_ids).order_by_last_deployed_at.to_a + environments = project.environments.available. + where(id: environment_ids).order_by_last_deployed_at.to_a environments.select! do |environment| Ability.allowed?(current_user, :read_environment, environment) diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index e018f8e7c4e..9a45ef06750 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -63,9 +63,9 @@ module Ci end def retry(build, current_user) - Ci::RetryBuildService - .new(build.project, current_user) - .execute(build) + Ci::RetryBuildService. + new(build.project, current_user). + execute(build) end end @@ -96,9 +96,9 @@ module Ci end def detailed_status(current_user) - Gitlab::Ci::Status::Build::Factory - .new(self, current_user) - .fabricate! + Gitlab::Ci::Status::Build::Factory. + new(self, current_user). + fabricate! end def manual? @@ -220,9 +220,9 @@ module Ci end def merge_request - merge_requests = MergeRequest.includes(:merge_request_diff) - .where(source_branch: ref, source_project_id: pipeline.gl_project_id) - .reorder(iid: :asc) + merge_requests = MergeRequest.includes(:merge_request_diff). + where(source_branch: ref, source_project_id: pipeline.gl_project_id). + reorder(iid: :asc) merge_requests.find do |merge_request| merge_request.commits_sha.include?(pipeline.sha) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 6e89b18aee5..ae4759ed2a0 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -89,9 +89,9 @@ module Ci # ref can't be HEAD or SHA, can only be branch/tag name scope :latest, ->(ref = nil) do - max_id = unscope(:select) - .select("max(#{quoted_table_name}.id)") - .group(:ref, :sha) + max_id = unscope(:select). + select("max(#{quoted_table_name}.id)"). + group(:ref, :sha) if ref where(ref: ref, id: max_id.where(ref: ref)) @@ -133,16 +133,16 @@ module Ci def stages # TODO, this needs refactoring, see gitlab-ce#26481. - stages_query = statuses - .group('stage').select(:stage).order('max(stage_idx)') + stages_query = statuses. + group('stage').select(:stage).order('max(stage_idx)') status_sql = statuses.latest.where('stage=sg.stage').status_sql - warnings_sql = statuses.latest.select('COUNT(*) > 0') - .where('stage=sg.stage').failed_but_allowed.to_sql + warnings_sql = statuses.latest.select('COUNT(*) > 0'). + where('stage=sg.stage').failed_but_allowed.to_sql - stages_with_statuses = CommitStatus.from(stages_query, :sg) - .pluck('sg.stage', status_sql, "(#{warnings_sql})") + stages_with_statuses = CommitStatus.from(stages_query, :sg). + pluck('sg.stage', status_sql, "(#{warnings_sql})") stages_with_statuses.map do |stage| Ci::Stage.new(self, Hash[%i[name status warnings].zip(stage)]) @@ -222,8 +222,8 @@ module Ci end def retry_failed(current_user) - Ci::RetryPipelineService.new(project, current_user) - .execute(self) + Ci::RetryPipelineService.new(project, current_user). + execute(self) end def mark_as_processable_after_stage(stage_idx) @@ -355,15 +355,15 @@ module Ci # Merge requests for which the current pipeline is running against # the merge request's latest commit. def merge_requests - @merge_requests ||= project.merge_requests - .where(source_branch: self.ref) - .select { |merge_request| merge_request.head_pipeline.try(:id) == self.id } + @merge_requests ||= project.merge_requests. + where(source_branch: self.ref). + select { |merge_request| merge_request.head_pipeline.try(:id) == self.id } end def detailed_status(current_user) - Gitlab::Ci::Status::Pipeline::Factory - .new(self, current_user) - .fabricate! + Gitlab::Ci::Status::Pipeline::Factory. + new(self, current_user). + fabricate! end private diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 07a086b0aca..9cda008a549 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -23,8 +23,8 @@ 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 diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index ca74c91b062..0751ab1b7d8 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -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 diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 99a6326309d..d31a6d81ebd 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -96,8 +96,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 @@ -133,9 +133,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 diff --git a/app/models/concerns/milestoneish.rb b/app/models/concerns/milestoneish.rb index f449229864d..870a6fbaa90 100644 --- a/app/models/concerns/milestoneish.rb +++ b/app/models/concerns/milestoneish.rb @@ -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 diff --git a/app/models/concerns/presentable.rb b/app/models/concerns/presentable.rb index 7b33b837004..d0f84831d71 100644 --- a/app/models/concerns/presentable.rb +++ b/app/models/concerns/presentable.rb @@ -1,7 +1,7 @@ module Presentable def present(**attributes) - Gitlab::View::Presenter::Factory - .new(self, attributes) - .fabricate! + Gitlab::View::Presenter::Factory. + new(self, attributes). + fabricate! end end diff --git a/app/models/concerns/subscribable.rb b/app/models/concerns/subscribable.rb index 83daa9b1a64..e4f5818d0e3 100644 --- a/app/models/concerns/subscribable.rb +++ b/app/models/concerns/subscribable.rb @@ -42,15 +42,15 @@ module Subscribable 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 diff --git a/app/models/generic_commit_status.rb b/app/models/generic_commit_status.rb index 8867ba0d2ff..36b8568871b 100644 --- a/app/models/generic_commit_status.rb +++ b/app/models/generic_commit_status.rb @@ -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 diff --git a/app/models/global_milestone.rb b/app/models/global_milestone.rb index b991d78e27f..84deb67ba9b 100644 --- a/app/models/global_milestone.rb +++ b/app/models/global_milestone.rb @@ -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 diff --git a/app/models/group.rb b/app/models/group.rb index 240a17f1dc1..1835ce118a1 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -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 diff --git a/app/models/label.rb b/app/models/label.rb index 5b6b9a7a736..8d76e422c67 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -34,9 +34,9 @@ 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) diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb index 7712d5783e0..ee9ac282e39 100644 --- a/app/models/lfs_object.rb +++ b/app/models/lfs_object.rb @@ -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 diff --git a/app/models/member.rb b/app/models/member.rb index d07f270b757..0f6b75b0b93 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -39,9 +39,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) } diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 204d2b153ad..a0b8a63d6ab 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -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 diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index 70bad2a4396..e1f172b24bf 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -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 diff --git a/app/models/namespace.rb b/app/models/namespace.rb index bd0336c984a..e207ac3db4e 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -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', diff --git a/app/models/network/commit.rb b/app/models/network/commit.rb index 8417f200e36..a48e872ad84 100644 --- a/app/models/network/commit.rb +++ b/app/models/network/commit.rb @@ -28,8 +28,8 @@ module Network if map.include?(p.id) map[p.id] end - end - .compact + end. + compact end end end diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb index b524ca50ee8..b16ecc424dd 100644 --- a/app/models/network/graph.rb +++ b/app/models/network/graph.rb @@ -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 diff --git a/app/serializers/base_serializer.rb b/app/serializers/base_serializer.rb index 311ee9c96be..032c44274ef 100644 --- a/app/serializers/base_serializer.rb +++ b/app/serializers/base_serializer.rb @@ -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) diff --git a/app/serializers/environment_serializer.rb b/app/serializers/environment_serializer.rb index d0a60f134da..ffc4fd34c75 100644 --- a/app/serializers/environment_serializer.rb +++ b/app/serializers/environment_serializer.rb @@ -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 diff --git a/app/services/after_branch_delete_service.rb b/app/services/after_branch_delete_service.rb index 227e9ea9c6d..95492f709bb 100644 --- a/app/services/after_branch_delete_service.rb +++ b/app/services/after_branch_delete_service.rb @@ -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 diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb index 8a94c54b6ab..2d664f3f0c8 100644 --- a/app/services/boards/issues/list_service.rb +++ b/app/services/boards/issues/list_service.rb @@ -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 diff --git a/app/services/boards/lists/destroy_service.rb b/app/services/boards/lists/destroy_service.rb index f986e05944c..6c80dd61873 100644 --- a/app/services/boards/lists/destroy_service.rb +++ b/app/services/boards/lists/destroy_service.rb @@ -17,8 +17,8 @@ module Boards attr_reader :board def decrement_higher_lists(list) - board.lists.movable.where('position > ?', list.position) - .update_all('position = position - 1') + board.lists.movable.where('position > ?', list.position). + update_all('position = position - 1') end def remove_list(list) diff --git a/app/services/boards/lists/move_service.rb b/app/services/boards/lists/move_service.rb index f2a68865f7b..2f109934ea9 100644 --- a/app/services/boards/lists/move_service.rb +++ b/app/services/boards/lists/move_service.rb @@ -33,15 +33,15 @@ module Boards end def decrement_intermediate_lists - board.lists.movable.where('position > ?', old_position) - .where('position <= ?', new_position) - .update_all('position = position - 1') + board.lists.movable.where('position > ?', old_position). + where('position <= ?', new_position). + update_all('position = position - 1') end def increment_intermediate_lists - board.lists.movable.where('position >= ?', new_position) - .where('position < ?', old_position) - .update_all('position = position + 1') + board.lists.movable.where('position >= ?', new_position). + where('position < ?', old_position). + update_all('position = position + 1') end def update_list_position(list) diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 38a85e9fc42..b53a467655f 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -48,9 +48,9 @@ module Ci Ci::Pipeline.transaction do pipeline.save - Ci::CreatePipelineBuildsService - .new(project, current_user) - .execute(pipeline) + Ci::CreatePipelineBuildsService. + new(project, current_user). + execute(pipeline) end pipeline.tap(&:process!) diff --git a/app/services/ci/process_pipeline_service.rb b/app/services/ci/process_pipeline_service.rb index 79eb97b7b55..442230abe29 100644 --- a/app/services/ci/process_pipeline_service.rb +++ b/app/services/ci/process_pipeline_service.rb @@ -78,9 +78,9 @@ module Ci def ensure_created_builds! return if created_builds.any? - Ci::CreatePipelineBuildsService - .new(project, current_user) - .execute(pipeline) + Ci::CreatePipelineBuildsService. + new(project, current_user). + execute(pipeline) end end end diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index 38ef323f6e5..c1fa9278f0f 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -2,8 +2,8 @@ module Ci class RetryBuildService < ::BaseService CLONE_ATTRIBUTES = %i[pipeline project ref tag options commands name allow_failure stage stage_idx trigger_request - yaml_variables when environment coverage_regex] - .freeze + yaml_variables when environment coverage_regex]. + freeze REJECT_ATTRIBUTES = %i[id status user token coverage trace runner artifacts_expire_at artifacts_file @@ -20,9 +20,9 @@ module Ci new_build.enqueue! - MergeRequests::AddTodoWhenBuildFailsService - .new(project, current_user) - .close(new_build) + MergeRequests::AddTodoWhenBuildFailsService. + new(project, current_user). + close(new_build) end end diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index 2c5e130e5aa..6e9781ca8cf 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -8,13 +8,13 @@ module Ci pipeline.builds.failed_or_canceled.find_each do |build| next unless build.retryable? - Ci::RetryBuildService.new(project, current_user) - .reprocess(build) + Ci::RetryBuildService.new(project, current_user). + reprocess(build) end - MergeRequests::AddTodoWhenBuildFailsService - .new(project, current_user) - .close_all(pipeline) + MergeRequests::AddTodoWhenBuildFailsService. + new(project, current_user). + close_all(pipeline) pipeline.process! end diff --git a/app/services/commits/change_service.rb b/app/services/commits/change_service.rb index 25e22f14e60..75281837b09 100644 --- a/app/services/commits/change_service.rb +++ b/app/services/commits/change_service.rb @@ -70,8 +70,8 @@ module Commits # Temporary branch exists and contains the change commit return if repository.find_branch(new_branch) - result = ValidateNewBranchService.new(@project, current_user) - .execute(new_branch) + result = ValidateNewBranchService.new(@project, current_user). + execute(new_branch) if result[:status] == :error raise ChangeError, "There was an error creating the source branch: #{result[:message]}" diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb index 77459d8779d..1b5e504573a 100644 --- a/app/services/create_branch_service.rb +++ b/app/services/create_branch_service.rb @@ -1,7 +1,7 @@ class CreateBranchService < BaseService def execute(branch_name, ref) - result = ValidateNewBranchService.new(project, current_user) - .execute(branch_name) + result = ValidateNewBranchService.new(project, current_user). + execute(branch_name) return result if result[:status] == :error diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index dbe2fda27b5..f681f831cbd 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -96,8 +96,8 @@ class GitPushService < BaseService # Update merge requests that may be affected by this push. A new branch # could cause the last commit of a merge request to change. # - UpdateMergeRequestsWorker - .perform_async(@project.id, current_user.id, params[:oldrev], params[:newrev], params[:ref]) + UpdateMergeRequestsWorker. + perform_async(@project.id, current_user.id, params[:oldrev], params[:newrev], params[:ref]) EventCreateService.new.push(@project, current_user, build_push_data) @project.execute_hooks(build_push_data.dup, :push_hooks) @@ -105,9 +105,9 @@ class GitPushService < BaseService Ci::CreatePipelineService.new(@project, current_user, build_push_data).execute if push_remove_branch? - AfterBranchDeleteService - .new(project, current_user) - .execute(branch_name) + AfterBranchDeleteService. + new(project, current_user). + execute(branch_name) end end diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb index a2a5f57d069..17b65947468 100644 --- a/app/services/issues/move_service.rb +++ b/app/services/issues/move_service.rb @@ -61,8 +61,8 @@ module Issues end def cloneable_milestone_id - @new_project.milestones - .find_by(title: @old_issue.milestone.try(:title)).try(:id) + @new_project.milestones. + find_by(title: @old_issue.milestone.try(:title)).try(:id) end def rewrite_notes diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index 5a53b973059..fd9d7de35f4 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -40,11 +40,11 @@ module MergeRequests # Returns all origin and fork merge requests from `@project` satisfying passed arguments. def merge_requests_for(source_branch, mr_states: [:opened]) - MergeRequest - .with_state(mr_states) - .where(source_branch: source_branch, source_project_id: @project.id) - .preload(:source_project) # we don't need a #includes since we're just preloading for the #select - .select(&:source_project) + MergeRequest. + with_state(mr_states). + where(source_branch: source_branch, source_project_id: @project.id). + preload(:source_project). # we don't need a #includes since we're just preloading for the #select + select(&:source_project) end def pipeline_merge_requests(pipeline) diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 581d18032e6..edee3032683 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -60,9 +60,9 @@ module MergeRequests by_source_or_target_branch(@branch_name).to_a # Fork merge requests - merge_requests += MergeRequest.opened - .where(source_branch: @branch_name, source_project: @project) - .where.not(target_project: @project).to_a + merge_requests += MergeRequest.opened. + where(source_branch: @branch_name, source_project: @project). + where.not(target_project: @project).to_a filter_merge_requests(merge_requests).each do |merge_request| if merge_request.source_branch == @branch_name || force_push? diff --git a/app/workers/build_coverage_worker.rb b/app/workers/build_coverage_worker.rb index def0ab1dde1..31e2dc448da 100644 --- a/app/workers/build_coverage_worker.rb +++ b/app/workers/build_coverage_worker.rb @@ -3,7 +3,7 @@ class BuildCoverageWorker include BuildQueue def perform(build_id) - Ci::Build.find_by(id: build_id) - .try(:update_coverage) + Ci::Build.find_by(id: build_id). + try(:update_coverage) end end diff --git a/app/workers/build_hooks_worker.rb b/app/workers/build_hooks_worker.rb index 9965af935d4..ff22313c491 100644 --- a/app/workers/build_hooks_worker.rb +++ b/app/workers/build_hooks_worker.rb @@ -3,7 +3,7 @@ class BuildHooksWorker include BuildQueue def perform(build_id) - Ci::Build.find_by(id: build_id) - .try(:execute_hooks) + Ci::Build.find_by(id: build_id). + try(:execute_hooks) end end diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb index f5ccc84c160..d4c3f14ec06 100644 --- a/app/workers/emails_on_push_worker.rb +++ b/app/workers/emails_on_push_worker.rb @@ -33,15 +33,15 @@ class EmailsOnPushWorker reverse_compare = false if action == :push - compare = CompareService.new(project, after_sha) - .execute(project, before_sha) + compare = CompareService.new(project, after_sha). + execute(project, before_sha) diff_refs = compare.diff_refs return false if compare.same if compare.commits.empty? - compare = CompareService.new(project, before_sha) - .execute(project, after_sha) + compare = CompareService.new(project, before_sha). + execute(project, after_sha) diff_refs = compare.diff_refs reverse_compare = true diff --git a/app/workers/expire_build_instance_artifacts_worker.rb b/app/workers/expire_build_instance_artifacts_worker.rb index eb403c134d1..2c29a9a58e1 100644 --- a/app/workers/expire_build_instance_artifacts_worker.rb +++ b/app/workers/expire_build_instance_artifacts_worker.rb @@ -3,10 +3,10 @@ class ExpireBuildInstanceArtifactsWorker include DedicatedSidekiqQueue def perform(build_id) - build = Ci::Build - .with_expired_artifacts - .reorder(nil) - .find_by(id: build_id) + build = Ci::Build. + with_expired_artifacts. + reorder(nil). + find_by(id: build_id) return unless build.try(:project) diff --git a/app/workers/pipeline_hooks_worker.rb b/app/workers/pipeline_hooks_worker.rb index 7e36eacebf8..7480a055e6a 100644 --- a/app/workers/pipeline_hooks_worker.rb +++ b/app/workers/pipeline_hooks_worker.rb @@ -3,7 +3,7 @@ class PipelineHooksWorker include PipelineQueue def perform(pipeline_id) - Ci::Pipeline.find_by(id: pipeline_id) - .try(:execute_hooks) + Ci::Pipeline.find_by(id: pipeline_id). + try(:execute_hooks) end end diff --git a/app/workers/pipeline_process_worker.rb b/app/workers/pipeline_process_worker.rb index 357e4a9a1c3..5dcb09f553e 100644 --- a/app/workers/pipeline_process_worker.rb +++ b/app/workers/pipeline_process_worker.rb @@ -3,7 +3,7 @@ class PipelineProcessWorker include PipelineQueue def perform(pipeline_id) - Ci::Pipeline.find_by(id: pipeline_id) - .try(:process!) + Ci::Pipeline.find_by(id: pipeline_id). + try(:process!) end end diff --git a/app/workers/pipeline_success_worker.rb b/app/workers/pipeline_success_worker.rb index cc0eb708cf9..ef710f374ca 100644 --- a/app/workers/pipeline_success_worker.rb +++ b/app/workers/pipeline_success_worker.rb @@ -4,9 +4,9 @@ class PipelineSuccessWorker def perform(pipeline_id) Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline| - MergeRequests::MergeWhenPipelineSucceedsService - .new(pipeline.project, nil) - .trigger(pipeline) + MergeRequests::MergeWhenPipelineSucceedsService. + new(pipeline.project, nil). + trigger(pipeline) end end end diff --git a/app/workers/pipeline_update_worker.rb b/app/workers/pipeline_update_worker.rb index 96c4152c674..e6d06d0577d 100644 --- a/app/workers/pipeline_update_worker.rb +++ b/app/workers/pipeline_update_worker.rb @@ -3,7 +3,7 @@ class PipelineUpdateWorker include PipelineQueue def perform(pipeline_id) - Ci::Pipeline.find_by(id: pipeline_id) - .try(:update_status) + Ci::Pipeline.find_by(id: pipeline_id). + try(:update_status) end end |