Commit 56de781a authored by Douwe Maan's avatar Douwe Maan

Revert "Enable Style/DotPosition"

This reverts commit e00fb2bdc2090e9cabeb1eb35a2672a882cc96e9.

# Conflicts:
#	.rubocop.yml
#	.rubocop_todo.yml
#	lib/gitlab/ci/config/entry/global.rb
#	lib/gitlab/ci/config/entry/jobs.rb
#	spec/lib/gitlab/ci/config/entry/factory_spec.rb
#	spec/lib/gitlab/ci/config/entry/global_spec.rb
#	spec/lib/gitlab/ci/config/entry/job_spec.rb
#	spec/lib/gitlab/ci/status/build/factory_spec.rb
#	spec/lib/gitlab/incoming_email_spec.rb
parent 1fe7501b
...@@ -163,11 +163,6 @@ Style/DefWithParentheses: ...@@ -163,11 +163,6 @@ Style/DefWithParentheses:
Style/Documentation: Style/Documentation:
Enabled: false Enabled: false
# This cop checks the . position in multi-line method calls.
Style/DotPosition:
Enabled: true
EnforcedStyle: trailing
# This cop checks for uses of double negation (!!) to convert something # This cop checks for uses of double negation (!!) to convert something
# to a boolean value. As this is both cryptic and usually redundant, it # to a boolean value. As this is both cryptic and usually redundant, it
# should be avoided. # should be avoided.
......
...@@ -63,7 +63,7 @@ Rails/SkipsModelValidations: ...@@ -63,7 +63,7 @@ Rails/SkipsModelValidations:
# Cop supports --auto-correct. # Cop supports --auto-correct.
Security/YAMLLoad: Security/YAMLLoad:
Enabled: false Enabled: false
# Offense count: 55 # Offense count: 55
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
...@@ -71,6 +71,13 @@ Security/YAMLLoad: ...@@ -71,6 +71,13 @@ Security/YAMLLoad:
Style/BarePercentLiterals: Style/BarePercentLiterals:
Enabled: false Enabled: false
# Offense count: 1304
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: leading, trailing
Style/DotPosition:
Enabled: false
# Offense count: 6 # Offense count: 6
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/EachWithObject: Style/EachWithObject:
......
...@@ -5,9 +5,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -5,9 +5,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end end
def update def update
successful = ApplicationSettings::UpdateService. successful = ApplicationSettings::UpdateService
new(@application_setting, current_user, application_setting_params). .new(@application_setting, current_user, application_setting_params)
execute .execute
if successful if successful
redirect_to admin_application_settings_path, redirect_to admin_application_settings_path,
......
...@@ -5,9 +5,9 @@ module IssuesAction ...@@ -5,9 +5,9 @@ module IssuesAction
def issues def issues
@label = issues_finder.labels.first @label = issues_finder.labels.first
@issues = issues_collection. @issues = issues_collection
non_archived. .non_archived
page(params[:page]) .page(params[:page])
@collection_type = "Issue" @collection_type = "Issue"
@issuable_meta_data = issuable_meta_data(@issues, @collection_type) @issuable_meta_data = issuable_meta_data(@issues, @collection_type)
......
...@@ -5,8 +5,8 @@ module MergeRequestsAction ...@@ -5,8 +5,8 @@ module MergeRequestsAction
def merge_requests def merge_requests
@label = merge_requests_finder.labels.first @label = merge_requests_finder.labels.first
@merge_requests = merge_requests_collection. @merge_requests = merge_requests_collection
page(params[:page]) .page(params[:page])
@collection_type = "MergeRequest" @collection_type = "MergeRequest"
@issuable_meta_data = issuable_meta_data(@merge_requests, @collection_type) @issuable_meta_data = issuable_meta_data(@merge_requests, @collection_type)
......
...@@ -29,9 +29,9 @@ class Import::BitbucketController < Import::BaseController ...@@ -29,9 +29,9 @@ class Import::BitbucketController < Import::BaseController
end end
def jobs def jobs
render json: current_user.created_projects. render json: current_user.created_projects
where(import_type: 'bitbucket'). .where(import_type: 'bitbucket')
to_json(only: [:id, :import_status]) .to_json(only: [:id, :import_status])
end end
def create def create
......
...@@ -4,15 +4,15 @@ class Projects::BadgesController < Projects::ApplicationController ...@@ -4,15 +4,15 @@ class Projects::BadgesController < Projects::ApplicationController
before_action :no_cache_headers, except: [:index] before_action :no_cache_headers, except: [:index]
def build def build
build_status = Gitlab::Badge::Build::Status. build_status = Gitlab::Badge::Build::Status
new(project, params[:ref]) .new(project, params[:ref])
render_badge build_status render_badge build_status
end end
def coverage def coverage
coverage_report = Gitlab::Badge::Coverage::Report. coverage_report = Gitlab::Badge::Coverage::Report
new(project, params[:ref], params[:job]) .new(project, params[:ref], params[:job])
render_badge coverage_report render_badge coverage_report
end end
......
...@@ -40,10 +40,10 @@ module Projects ...@@ -40,10 +40,10 @@ module Projects
def issue def issue
@issue ||= @issue ||=
IssuesFinder.new(current_user, project_id: project.id). IssuesFinder.new(current_user, project_id: project.id)
execute. .execute
where(iid: params[:id]). .where(iid: params[:id])
first! .first!
end end
def authorize_read_issue! def authorize_read_issue!
......
...@@ -35,9 +35,9 @@ class Projects::CommitController < Projects::ApplicationController ...@@ -35,9 +35,9 @@ class Projects::CommitController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.json do format.json do
render json: PipelineSerializer. render json: PipelineSerializer
new(project: @project, user: @current_user). .new(project: @project, user: @current_user)
represent(@pipelines) .represent(@pipelines)
end end
end end
end end
......
...@@ -46,8 +46,8 @@ class Projects::CompareController < Projects::ApplicationController ...@@ -46,8 +46,8 @@ class Projects::CompareController < Projects::ApplicationController
end end
def define_diff_vars def define_diff_vars
@compare = CompareService.new(@project, @head_ref). @compare = CompareService.new(@project, @head_ref)
execute(@project, @start_ref) .execute(@project, @start_ref)
if @compare if @compare
@commits = @compare.commits @commits = @compare.commits
......
...@@ -9,18 +9,18 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -9,18 +9,18 @@ class Projects::EnvironmentsController < Projects::ApplicationController
before_action :verify_api_request!, only: :terminal_websocket_authorize before_action :verify_api_request!, only: :terminal_websocket_authorize
def index def index
@environments = project.environments. @environments = project.environments
with_state(params[:scope] || :available) .with_state(params[:scope] || :available)
respond_to do |format| respond_to do |format|
format.html format.html
format.json do format.json do
render json: { render json: {
environments: EnvironmentSerializer. environments: EnvironmentSerializer
new(project: @project, user: @current_user). .new(project: @project, user: @current_user)
with_pagination(request, response). .with_pagination(request, response)
within_folders. .within_folders
represent(@environments), .represent(@environments),
available_count: project.environments.available.count, available_count: project.environments.available.count,
stopped_count: project.environments.stopped.count stopped_count: project.environments.stopped.count
} }
...@@ -36,10 +36,10 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -36,10 +36,10 @@ class Projects::EnvironmentsController < Projects::ApplicationController
format.html format.html
format.json do format.json do
render json: { render json: {
environments: EnvironmentSerializer. environments: EnvironmentSerializer
new(project: @project, user: @current_user). .new(project: @project, user: @current_user)
with_pagination(request, response). .with_pagination(request, response)
represent(@environments), .represent(@environments),
available_count: folder_environments.available.count, available_count: folder_environments.available.count,
stopped_count: folder_environments.stopped.count stopped_count: folder_environments.stopped.count
} }
......
...@@ -232,9 +232,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -232,9 +232,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
format.json do format.json do
render json: PipelineSerializer. render json: PipelineSerializer
new(project: @project, user: @current_user). .new(project: @project, user: @current_user)
represent(@pipelines) .represent(@pipelines)
end end
end end
end end
...@@ -245,9 +245,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -245,9 +245,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
format.json do format.json do
define_pipelines_vars define_pipelines_vars
render json: PipelineSerializer. render json: PipelineSerializer
new(project: @project, user: @current_user). .new(project: @project, user: @current_user)
represent(@pipelines) .represent(@pipelines)
end end
end end
end end
...@@ -332,9 +332,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -332,9 +332,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
return access_denied! return access_denied!
end end
MergeRequests::MergeWhenPipelineSucceedsService. MergeRequests::MergeWhenPipelineSucceedsService
new(@project, current_user). .new(@project, current_user)
cancel(@merge_request) .cancel(@merge_request)
end end
def merge def merge
...@@ -361,9 +361,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -361,9 +361,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
if @merge_request.head_pipeline.active? if @merge_request.head_pipeline.active?
MergeRequests::MergeWhenPipelineSucceedsService. MergeRequests::MergeWhenPipelineSucceedsService
new(@project, current_user, merge_params). .new(@project, current_user, merge_params)
execute(@merge_request) .execute(@merge_request)
@status = :merge_when_build_succeeds @status = :merge_when_build_succeeds
elsif @merge_request.head_pipeline.success? elsif @merge_request.head_pipeline.success?
...@@ -640,8 +640,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -640,8 +640,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
def merge_request_params def merge_request_params
params.require(:merge_request). params.require(:merge_request)
permit(merge_request_params_ce) .permit(merge_request_params_ce)
end end
def merge_request_params_ce def merge_request_params_ce
......
...@@ -7,11 +7,11 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -7,11 +7,11 @@ class Projects::PipelinesController < Projects::ApplicationController
def index def index
@scope = params[:scope] @scope = params[:scope]
@pipelines = PipelinesFinder. @pipelines = PipelinesFinder
new(project). .new(project)
execute(scope: @scope). .execute(scope: @scope)
page(params[:page]). .page(params[:page])
per(30) .per(30)
@running_count = PipelinesFinder. @running_count = PipelinesFinder.
.new(project).execute(scope: 'running').count .new(project).execute(scope: 'running').count
...@@ -29,10 +29,10 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -29,10 +29,10 @@ class Projects::PipelinesController < Projects::ApplicationController
format.html format.html
format.json do format.json do
render json: { render json: {
pipelines: PipelineSerializer. pipelines: PipelineSerializer
new(project: @project, user: @current_user). .new(project: @project, user: @current_user)
with_pagination(request, response). .with_pagination(request, response)
represent(@pipelines), .represent(@pipelines),
count: { count: {
all: @pipelines_count, all: @pipelines_count,
running: @running_count, running: @running_count,
...@@ -49,9 +49,9 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -49,9 +49,9 @@ class Projects::PipelinesController < Projects::ApplicationController
end end
def create def create
@pipeline = Ci::CreatePipelineService. @pipeline = Ci::CreatePipelineService
new(project, current_user, create_params). .new(project, current_user, create_params)
execute(ignore_skip_ci: true, save_on_errors: false) .execute(ignore_skip_ci: true, save_on_errors: false)
unless @pipeline.persisted? unless @pipeline.persisted?
render 'new' render 'new'
return return
......
...@@ -293,8 +293,8 @@ class ProjectsController < Projects::ApplicationController ...@@ -293,8 +293,8 @@ class ProjectsController < Projects::ApplicationController
end end
def project_params def project_params
params.require(:project). params.require(:project)
permit(project_params_ce) .permit(project_params_ce)
end end
def project_params_ce def project_params_ce
......
...@@ -118,8 +118,8 @@ class UsersController < ApplicationController ...@@ -118,8 +118,8 @@ class UsersController < ApplicationController
def load_projects def load_projects
@projects = @projects =
PersonalProjectsFinder.new(user).execute(current_user). PersonalProjectsFinder.new(user).execute(current_user)
page(params[:page]) .page(params[:page])
end end
def load_contributed_projects def load_contributed_projects
......
...@@ -17,12 +17,12 @@ class EnvironmentsFinder ...@@ -17,12 +17,12 @@ class EnvironmentsFinder
deployments.none deployments.none
end end
environment_ids = deployments. environment_ids = deployments
group(:environment_id). .group(:environment_id)
select(:environment_id) .select(:environment_id)
environments = project.environments.available. environments = project.environments.available
where(id: environment_ids).order_by_last_deployed_at.to_a .where(id: environment_ids).order_by_last_deployed_at.to_a
environments.select! do |environment| environments.select! do |environment|
Ability.allowed?(current_user, :read_environment, environment) Ability.allowed?(current_user, :read_environment, environment)
......
...@@ -65,9 +65,9 @@ module Ci ...@@ -65,9 +65,9 @@ module Ci
end end
def retry(build, current_user) def retry(build, current_user)
Ci::RetryBuildService. Ci::RetryBuildService
new(build.project, current_user). .new(build.project, current_user)
execute(build) .execute(build)
end end
end end
...@@ -98,9 +98,9 @@ module Ci ...@@ -98,9 +98,9 @@ module Ci
end end
def detailed_status(current_user) def detailed_status(current_user)
Gitlab::Ci::Status::Build::Factory. Gitlab::Ci::Status::Build::Factory
new(self, current_user). .new(self, current_user)
fabricate! .fabricate!
end end
def manual? def manual?
...@@ -222,9 +222,9 @@ module Ci ...@@ -222,9 +222,9 @@ module Ci
end end
def merge_request def merge_request
merge_requests = MergeRequest.includes(:merge_request_diff). merge_requests = MergeRequest.includes(:merge_request_diff)
where(source_branch: ref, source_project_id: pipeline.gl_project_id). .where(source_branch: ref, source_project_id: pipeline.gl_project_id)
reorder(iid: :asc) .reorder(iid: :asc)
merge_requests.find do |merge_request| merge_requests.find do |merge_request|
merge_request.commits_sha.include?(pipeline.sha) merge_request.commits_sha.include?(pipeline.sha)
......
...@@ -91,9 +91,9 @@ module Ci ...@@ -91,9 +91,9 @@ module Ci
# ref can't be HEAD or SHA, can only be branch/tag name # ref can't be HEAD or SHA, can only be branch/tag name
scope :latest, ->(ref = nil) do scope :latest, ->(ref = nil) do
max_id = unscope(:select). max_id = unscope(:select)
select("max(#{quoted_table_name}.id)"). .select("max(#{quoted_table_name}.id)")
group(:ref, :sha) .group(:ref, :sha)
if ref if ref
where(ref: ref, id: max_id.where(ref: ref)) where(ref: ref, id: max_id.where(ref: ref))
...@@ -135,16 +135,16 @@ module Ci ...@@ -135,16 +135,16 @@ module Ci
def stages def stages
# TODO, this needs refactoring, see gitlab-ce#26481. # TODO, this needs refactoring, see gitlab-ce#26481.
stages_query = statuses. stages_query = statuses
group('stage').select(:stage).order('max(stage_idx)') .group('stage').select(:stage).order('max(stage_idx)')
status_sql = statuses.latest.where('stage=sg.stage').status_sql status_sql = statuses.latest.where('stage=sg.stage').status_sql
warnings_sql = statuses.latest.select('COUNT(*) > 0'). warnings_sql = statuses.latest.select('COUNT(*) > 0')
where('stage=sg.stage').failed_but_allowed.to_sql .where('stage=sg.stage').failed_but_allowed.to_sql
stages_with_statuses = CommitStatus.from(stages_query, :sg). stages_with_statuses = CommitStatus.from(stages_query, :sg)
pluck('sg.stage', status_sql, "(#{warnings_sql})") .pluck('sg.stage', status_sql, "(#{warnings_sql})")
stages_with_statuses.map do |stage| stages_with_statuses.map do |stage|
Ci::Stage.new(self, Hash[%i[name status warnings].zip(stage)]) Ci::Stage.new(self, Hash[%i[name status warnings].zip(stage)])
...@@ -220,8 +220,8 @@ module Ci ...@@ -220,8 +220,8 @@ module Ci
end end
def retry_failed(current_user) def retry_failed(current_user)
Ci::RetryPipelineService.new(project, current_user). Ci::RetryPipelineService.new(project, current_user)
execute(self) .execute(self)
end end
def mark_as_processable_after_stage(stage_idx) def mark_as_processable_after_stage(stage_idx)
...@@ -353,15 +353,15 @@ module Ci ...@@ -353,15 +353,15 @@ module Ci
# Merge requests for which the current pipeline is running against # Merge requests for which the current pipeline is running against
# the merge request's latest commit. # the merge request's latest commit.
def merge_requests def merge_requests
@merge_requests ||= project.merge_requests. @merge_requests ||= project.merge_requests
where(source_branch: self.ref). .where(source_branch: self.ref)
select { |merge_request| merge_request.head_pipeline.try(:id) == self.id } .select { |merge_request| merge_request.head_pipeline.try(:id) == self.id }
end end
def detailed_status(current_user) def detailed_status(current_user)
Gitlab::Ci::Status::Pipeline::Factory. Gitlab::Ci::Status::Pipeline::Factory
new(self, current_user). .new(self, current_user)
fabricate! .fabricate!
end end
private private
......
...@@ -23,8 +23,8 @@ module Ci ...@@ -23,8 +23,8 @@ module Ci
scope :ordered, ->() { order(id: :desc) } scope :ordered, ->() { order(id: :desc) }
scope :owned_or_shared, ->(project_id) do scope :owned_or_shared, ->(project_id) do
joins('LEFT JOIN ci_runner_projects ON ci_runner_projects.runner_id = ci_runners.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) .where("ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true", project_id: project_id)
end end
scope :assignable_for, ->(project) do scope :assignable_for, ->(project) do
......
...@@ -28,9 +28,9 @@ module Ci ...@@ -28,9 +28,9 @@ module Ci
end end
def detailed_status(current_user) def detailed_status(current_user)
Gitlab::Ci::Status::Stage::Factory. Gitlab::Ci::Status::Stage::Factory
new(self, current_user). .new(self, current_user)
fabricate! .fabricate!
end end
def statuses def statuses
......
...@@ -97,8 +97,8 @@ class CommitStatus < ActiveRecord::Base ...@@ -97,8 +97,8 @@ class CommitStatus < ActiveRecord::Base
after_transition any => :failed do |commit_status| after_transition any => :failed do |commit_status|
commit_status.run_after_commit do commit_status.run_after_commit do
MergeRequests::AddTodoWhenBuildFailsService.