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.
......
...@@ -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. MergeRequests::AddTodoWhenBuildFailsService
new(pipeline.project, nil).execute(self) .new(pipeline.project, nil).execute(self)
end end
end end
end end
...@@ -132,9 +132,9 @@ class CommitStatus < ActiveRecord::Base ...@@ -132,9 +132,9 @@ class CommitStatus < ActiveRecord::Base
end end
def detailed_status(current_user) def detailed_status(current_user)
Gitlab::Ci::Status::Factory. Gitlab::Ci::Status::Factory
new(self, current_user). .new(self, current_user)
fabricate! .fabricate!
end end
def sortable_name def sortable_name
......
...@@ -39,8 +39,8 @@ module Milestoneish ...@@ -39,8 +39,8 @@ module Milestoneish
def issues_visible_to_user(user) def issues_visible_to_user(user)
memoize_per_user(user, :issues_visible_to_user) do memoize_per_user(user, :issues_visible_to_user) do
IssuesFinder.new(user, issues_finder_params). IssuesFinder.new(user, issues_finder_params)
execute.where(milestone_id: milestoneish_ids) .execute.where(milestone_id: milestoneish_ids)
end end
end end
......
module Presentable module Presentable
def present(**attributes) def present(**attributes)
Gitlab::View::Presenter::Factory. Gitlab::View::Presenter::Factory
new(self, attributes). .new(self, attributes)
fabricate! .fabricate!
end end
end end
...@@ -42,15 +42,15 @@ module Subscribable ...@@ -42,15 +42,15 @@ module Subscribable
def subscribe(user, project = nil) def subscribe(user, project = nil)
unsubscribe_from_other_levels(user, project) unsubscribe_from_other_levels(user, project)
find_or_initialize_subscription(user, project). find_or_initialize_subscription(user, project)
update(subscribed: true) .update(subscribed: true)
end end
def unsubscribe(user, project = nil) def unsubscribe(user, project = nil)
unsubscribe_from_other_levels(user, project) unsubscribe_from_other_levels(user, project)
find_or_initialize_subscription(user, project). find_or_initialize_subscription(user, project)
update(subscribed: false) .update(subscribed: false)
end end
private private
......
...@@ -18,8 +18,8 @@ class GenericCommitStatus < CommitStatus ...@@ -18,8 +18,8 @@ class GenericCommitStatus < CommitStatus
end end
def detailed_status(current_user) def detailed_status(current_user)
Gitlab::Ci::Status::External::Factory. Gitlab::Ci::Status::External::Factory
new(self, current_user). .new(self, current_user)
fabricate! .fabricate!
end end
end end
...@@ -76,8 +76,8 @@ class GlobalMilestone ...@@ -76,8 +76,8 @@ class GlobalMilestone
end end
def labels def labels
@labels ||= GlobalLabel.build_collection(milestones.includes(:labels).map(&:labels).flatten). @labels ||= GlobalLabel.build_collection(milestones.includes(:labels).map(&:labels).flatten)
sort_by!(&:title) .sort_by!(&:title)
end end
def due_date def due_date
......
...@@ -71,9 +71,9 @@ class Group < Namespace ...@@ -71,9 +71,9 @@ class Group < Namespace
def select_for_project_authorization def select_for_project_authorization
if current_scope.joins_values.include?(:shared_projects) if current_scope.joins_values.include?(:shared_projects)
joins('INNER JOIN namespaces project_namespace ON project_namespace.id = projects.namespace_id'). joins('INNER JOIN namespaces project_namespace ON project_namespace.id = projects.namespace_id')
where('project_namespace.share_with_group_lock = ?', false). .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") .select("members.user_id, projects.id AS project_id, LEAST(project_group_links.group_access, members.access_level) AS access_level")
else else
super super
end end
......
...@@ -34,9 +34,9 @@ class Label < ActiveRecord::Base ...@@ -34,9 +34,9 @@ class Label < ActiveRecord::Base
scope :with_title, ->(title) { where(title: title) } scope :with_title, ->(title) { where(title: title) }
def self.prioritized(project) def self.prioritized(project)
joins(:priorities). joins(:priorities)
where(label_priorities: { project_id: project }). .where(label_priorities: { project_id: project })
reorder('label_priorities.priority ASC, labels.title ASC') .reorder('label_priorities.priority ASC, labels.title ASC')
end end
def self.unprioritized(project) def self.unprioritized(project)
......
...@@ -19,8 +19,8 @@ class LfsObject < ActiveRecord::Base ...@@ -19,8 +19,8 @@ class LfsObject < ActiveRecord::Base
end end
def self.destroy_unreferenced def self.destroy_unreferenced
joins("LEFT JOIN lfs_objects_projects ON lfs_objects_projects.lfs_object_id = #{table_name}.id"). joins("LEFT JOIN lfs_objects_projects ON lfs_objects_projects.lfs_object_id = #{table_name}.id")
where(lfs_objects_projects: { id: nil }). .where(lfs_objects_projects: { id: nil })
destroy_all .destroy_all
end end
end end
...@@ -41,9 +41,9 @@ class Member < ActiveRecord::Base ...@@ -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)) 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) user_is_active = User.arel_table[:state].eq(:active)
includes(:user).references(:users). includes(:user).references(:users)
where(is_external_invite.or(user_is_active)). .where(is_external_invite.or(user_is_active))
where(requested_at: nil) .where(requested_at: nil)
end end
scope :invite, -> { where.not(invite_token: nil) } scope :invite, -> { where.not(invite_token: nil) }
......
...@@ -813,9 +813,9 @@ class MergeRequest < ActiveRecord::Base ...@@ -813,9 +813,9 @@ class MergeRequest < ActiveRecord::Base
def all_pipelines def all_pipelines
return Ci::Pipeline.none unless source_project return Ci::Pipeline.none unless source_project
@all_pipelines ||= source_project.pipelines. @all_pipelines ||= source_project.pipelines
where(sha: all_commits_sha, ref: source_branch). .where(sha: all_commits_sha, ref: source_branch)
order(id: :desc) .order(id: :desc)
end end
# Note that this could also return SHA from now dangling commits # Note that this could also return SHA from now dangling commits
......
...@@ -169,8 +169,8 @@ class MergeRequestDiff < ActiveRecord::Base ...@@ -169,8 +169,8 @@ class MergeRequestDiff < ActiveRecord::Base
# When compare merge request versions we want diff A..B instead of A...B # 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. # 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. # For this reason we set straight to true by default.
CompareService.new(project, head_commit_sha). CompareService.new(project, head_commit_sha)
execute(project, sha, straight: straight) .execute(project, sha, straight: straight)
end end
def commits_count def commits_count
......
...@@ -48,9 +48,9 @@ class Namespace < ActiveRecord::Base ...@@ -48,9 +48,9 @@ class Namespace < ActiveRecord::Base
scope :root, -> { where('type IS NULL') } scope :root, -> { where('type IS NULL') }
scope :with_statistics, -> do scope :with_statistics, -> do
joins('LEFT JOIN project_statistics ps ON ps.namespace_id = namespaces.id'). joins('LEFT JOIN project_statistics ps ON ps.namespace_id = namespaces.id')
group('namespaces.id'). .group('namespaces.id')
select( .select(
'namespaces.*', 'namespaces.*',
'COALESCE(SUM(ps.storage_size), 0) AS storage_size', 'COALESCE(SUM(ps.storage_size), 0) AS storage_size',
'COALESCE(SUM(ps.repository_size), 0) AS repository_size', 'COALESCE(SUM(ps.repository_size), 0) AS repository_size',
......
...@@ -28,8 +28,8 @@ module Network ...@@ -28,8 +28,8 @@ module Network
if map.include?(p.id) if map.include?(p.id)
map[p.id] map[p.id]
end end
end. end
compact .compact
end end
end end
end end
...@@ -23,12 +23,12 @@ module Network ...@@ -23,12 +23,12 @@ module Network
def collect_notes def collect_notes
h = Hash.new(0) h = Hash.new(0)
@project. @project
notes. .notes
where('noteable_type = ?', 'Commit'). .where('noteable_type = ?', 'Commit')
group('notes.commit_id'). .group('notes.commit_id')
select('notes.commit_id, count(notes.id) as note_count'). .select('notes.commit_id, count(notes.id) as note_count')
each do |item| .each do |item|
h[item.commit_id] = item.note_count.to_i h[item.commit_id] = item.note_count.to_i
end end
......
...@@ -4,9 +4,9 @@ class BaseSerializer ...@@ -4,9 +4,9 @@ class BaseSerializer
end end
def represent(resource, opts = {}) def represent(resource, opts = {})
self.class.entity_class. self.class.entity_class
represent(resource, opts.merge(request: @request)). .represent(resource, opts.merge(request: @request))
as_json .as_json
end end
def self.entity(entity_class) def self.entity(entity_class)
......
...@@ -36,9 +36,9 @@ class EnvironmentSerializer < BaseSerializer ...@@ -36,9 +36,9 @@ class EnvironmentSerializer < BaseSerializer
private private
def itemize(resource) def itemize(resource)
items = resource.order('folder_name ASC'). items = resource.order('folder_name ASC')
group('COALESCE(environment_type, name)'). .group('COALESCE(environment_type, name)')
select('COALESCE(environment_type, name) AS folder_name', .select('COALESCE(environment_type, name) AS folder_name',
'COUNT(*) AS size', 'MAX(id) AS last_id') 'COUNT(*) AS size', 'MAX(id) AS last_id')
# It makes a difference when you call `paginate` method, because # It makes a difference when you call `paginate` method, because
......
...@@ -14,8 +14,8 @@ class AfterBranchDeleteService < BaseService ...@@ -14,8 +14,8 @@ class AfterBranchDeleteService < BaseService
private private
def stop_environments def stop_environments
Ci::StopEnvironmentsService. Ci::StopEnvironmentsService
new(project, current_user). .new(project, current_user)
execute(branch_name) .execute(branch_name)
end end
end end
...@@ -57,15 +57,15 @@ module Boards ...@@ -57,15 +57,15 @@ module Boards
return issues unless board_label_ids.any? return issues unless board_label_ids.any?
issues.where.not( issues.where.not(
LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id"). LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id")
where(label_id: board_label_ids).limit(1).arel.exists .where(label_id: board_label_ids).limit(1).arel.exists
) )
end end
def with_list_label(issues) def with_list_label(issues)
issues.where( issues.where(
LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id"). 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 .where("label_links.label_id = ?", list.label_id).limit(1).arel.exists
) )
end end
end end
......
...@@ -17,8 +17,8 @@ module Boards ...@@ -17,8 +17,8 @@ module Boards
attr_reader :board attr_reader :board
def decrement_higher_lists(list) def decrement_higher_lists(list)
board.lists.movable.where('position > ?', list.position). board.lists.movable.where('position > ?', list.position)
update_all('position = position - 1') .update_all('position = position - 1')
end end
def remove_list(list) def remove_list(list)
......
...@@ -33,15 +33,15 @@ module Boards ...@@ -33,15 +33,15 @@ module Boards
end end
def decrement_intermediate_lists def decrement_intermediate_lists
board.lists.movable.where('position > ?', old_position). board.lists.movable.where('position > ?', old_position)
where('position <= ?', new_position). .where('position <= ?', new_position)
update_all('position = position - 1') .update_all('position = position - 1')
end end
def increment_intermediate_lists def increment_intermediate_lists
board.lists.movable.where('position >= ?', new_position). board.lists.movable.where('position >= ?', new_position)
where('position < ?', old_position). .where('position < ?', old_position)
update_all('position = position + 1') .update_all('position = position + 1')
end end
def update_list_position(list) def update_list_position(list)
......
...@@ -48,9 +48,9 @@ module Ci ...@@ -48,9 +48,9 @@ module Ci
Ci::Pipeline.transaction do Ci::Pipeline.transaction do
pipeline.save pipeline.save
Ci::CreatePipelineBuildsService. Ci::CreatePipelineBuildsService
new(project, current_user). .new(project, current_user)
execute(pipeline) .execute(pipeline)
end end
pipeline.tap(&:process!) pipeline.tap(&:process!)
......
...@@ -78,9 +78,9 @@ module Ci ...@@ -78,9 +78,9 @@ module Ci
def ensure_created_builds! def ensure_created_builds!
return if created_builds.any? return if created_builds.any?
Ci::CreatePipelineBuildsService. Ci::CreatePipelineBuildsService
new(project, current_user). .new(project, current_user)
execute(pipeline) .execute(pipeline)
end end
end end
end end
...@@ -2,8 +2,8 @@ module Ci ...@@ -2,8 +2,8 @@ module Ci
class RetryBuildService < ::BaseService class RetryBuildService < ::BaseService
CLONE_ATTRIBUTES = %i[pipeline project ref tag options commands name CLONE_ATTRIBUTES = %i[pipeline project ref tag options commands name
allow_failure stage stage_idx trigger_request allow_failure stage stage_idx trigger_request
yaml_variables when environment coverage_regex]. yaml_variables when environment coverage_regex]
freeze .freeze
REJECT_ATTRIBUTES = %i[id status user token coverage trace runner REJECT_ATTRIBUTES = %i[id status user token coverage trace runner
artifacts_expire_at artifacts_file artifacts_expire_at artifacts_file
...@@ -20,9 +20,9 @@ module Ci ...@@ -20,9 +20,9 @@ module Ci
new_build.enqueue! new_build.enqueue!
MergeRequests::AddTodoWhenBuildFailsService. MergeRequests::AddTodoWhenBuildFailsService
new(project, current_user). .new(project, current_user)
close(new_build) .close(new_build)
end end
end end
......
...@@ -8,13 +8,13 @@ module Ci ...@@ -8,13 +8,13 @@ module Ci
pipeline.builds.failed_or_canceled.find_each do |build| pipeline.builds.failed_or_canceled.find_each do |build|
next unless build.retryable? next unless build.retryable?
Ci::RetryBuildService.new(project, current_user). Ci::RetryBuildService.new(project, current_user)
reprocess(build) .reprocess(build)
end end
MergeRequests::AddTodoWhenBuildFailsService. MergeRequests::AddTodoWhenBuildFailsService
new(project, current_user). .new(project, current_user)
close_all(pipeline) .close_all(pipeline)
pipeline.process! pipeline.process!
end end
......
...@@ -70,8 +70,8 @@ module Commits ...@@ -70,8 +70,8 @@ module Commits
# Temporary branch exists and contains the change commit # Temporary branch exists and contains the change commit
return if repository.find_branch(new_branch) return if repository.find_branch(new_branch)
result = ValidateNewBranchService.new(@project, current_user). result = ValidateNewBranchService.new(@project, current_user)
execute(new_branch) .execute(new_branch)
if result[:status] == :error if result[:status] == :error
raise ChangeError, "There was an error creating the source branch: #{result[:message]}" raise ChangeError, "There was an error creating the source branch: #{result[:message]}"
......
class CreateBranchService < BaseService class CreateBranchService < BaseService
def execute(branch_name, ref) def execute(branch_name, ref)
result = ValidateNewBranchService.new(project, current_user). result = ValidateNewBranchService.new(project, current_user)
execute(branch_name) .execute(branch_name)
return result if result[:status] == :error return result if result[:status] == :error
......
...@@ -96,8 +96,8 @@ class GitPushService < BaseService ...@@ -96,8 +96,8 @@ class GitPushService < BaseService
# Update merge requests that may be affected by this push. A new branch # Update merge requests that may be affected by this push. A new branch
# could cause the last commit of a merge request to change. # could cause the last commit of a merge request to change.
# #
UpdateMergeRequestsWorker. UpdateMergeRequestsWorker
perform_async(@project.id, current_user.id, params[:oldrev], params[:newrev], params[:ref]) .perform_async(@project.id, current_user.id, params[:oldrev], params[:newrev], params[:ref])
EventCreateService.new.push(@project, current_user, build_push_data) EventCreateService.new.push(@project, current_user, build_push_data)
@project.execute_hooks(build_push_data.dup, :push_hooks) @project.execute_hooks(build_push_data.dup, :push_hooks)
...@@ -105,9 +105,9 @@ class GitPushService < BaseService ...@@ -105,9 +105,9 @@ class GitPushService < BaseService
Ci::CreatePipelineService.new(@project, current_user, build_push_data).execute Ci::CreatePipelineService.new(@project, current_user, build_push_data).execute
if push_remove_branch? if push_remove_branch?
AfterBranchDeleteService. AfterBranchDeleteService
new(project, current_user). .new(project, current_user)
execute(branch_name) .execute(branch_name)
end end
end end
......
...@@ -61,8 +61,8 @@ module Issues ...@@ -61,8 +61,8 @@ module Issues
end end
def cloneable_milestone_id def cloneable_milestone_id
@new_project.milestones. @new_project.milestones
find_by(title: @old_issue.milestone.try(:title)).try(:id) .find_by(title: @old_issue.milestone.try(:title)).try(:id)
end end
def rewrite_notes def rewrite_notes
......
...@@ -40,11 +40,11 @@ module MergeRequests ...@@ -40,11 +40,11 @@ module MergeRequests
# Returns all origin and fork merge requests from `@project` satisfying passed arguments. # Returns all origin and fork merge requests from `@project` satisfying passed arguments.
def merge_requests_for(source_branch, mr_states: [:opened]) def merge_requests_for(source_branch, mr_states: [:opened])
MergeRequest. MergeRequest
with_state(mr_states). .with_state(mr_states)
where(source_branch: source_branch, source_project_id: @project.id). .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 .preload(:source_project) # we don't need a #includes since we're just preloading for the #select
select(&:source_project) .select(&:source_project)
end end
def pipeline_merge_requests(pipeline) def pipeline_merge_requests(pipeline)
......
...@@ -60,9 +60,9 @@ module MergeRequests ...@@ -60,9 +60,9 @@ module MergeRequests
by_source_or_target_branch(@branch_name).to_a by_source_or_target_branch(@branch_name).to_a
# Fork merge requests # Fork merge requests
merge_requests += MergeRequest.opened. merge_requests += MergeRequest.opened
where(source_branch: @branch_name, source_project: @project). .where(source_branch: @branch_name, source_project: @project)
where.not(target_project: @project).to_a .where.not(target_project: @project).to_a
filter_merge_requests(merge_requests).each do |merge_request| filter_merge_requests(merge_requests).each do |merge_request|
if merge_request.source_branch == @branch_name || force_push? if merge_request.source_branch == @branch_name || force_push?
......
...@@ -3,7 +3,7 @@ class BuildCoverageWorker ...@@ -3,7 +3,7 @@ class BuildCoverageWorker
include BuildQueue include BuildQueue
def perform(build_id) def perform(build_id)
Ci::Build.find_by(id: build_id). Ci::Build.find_by(id: build_id)
try(:update_coverage) .try(:update_coverage)
end end
end end
...@@ -3,7 +3,7 @@ class BuildHooksWorker ...@@ -3,7 +3,7 @@ class BuildHooksWorker
include BuildQueue include BuildQueue
def perform(build_id) def perform(build_id)
Ci::Build.find_by(id: build_id). Ci::Build.find_by(id: build_id)
try(:execute_hooks) .try(:execute_hooks)
end end
end end
...@@ -33,15 +33,15 @@ class EmailsOnPushWorker ...@@ -33,15 +33,15 @@ class EmailsOnPushWorker
reverse_compare = false reverse_compare = false
if action == :push if action == :push
compare = CompareService.new(project, after_sha). compare = CompareService.new(project, after_sha)
execute(project, before_sha) .execute(project, before_sha)
diff_refs = compare.diff_refs diff_refs = compare.diff_refs
return false if compare.same return false if compare.same
if compare.commits.empty? if compare.commits.empty?
compare = CompareService.new(project, before_sha). compare = CompareService.new(project, before_sha)
execute(project, after_sha) .execute(project, after_sha)
diff_refs = compare.diff_refs diff_refs = compare.diff_refs
reverse_compare = true reverse_compare = true
......
...@@ -3,10 +3,10 @@ class ExpireBuildInstanceArtifactsWorker ...@@ -3,10 +3,10 @@ class ExpireBuildInstanceArtifactsWorker
include DedicatedSidekiqQueue include DedicatedSidekiqQueue
def perform(build_id) def perform(build_id)
build = Ci::Build. build = Ci::Build
with_expired_artifacts. .with_expired_artifacts
reorder(nil). .reorder(nil)
find_by(id: build_id) .find_by(id: build_id)
return unless build.try(:project) return unless build.try(:project)
......
...@@ -3,7 +3,7 @@ class PipelineHooksWorker ...@@ -3,7 +3,7 @@ class PipelineHooksWorker
include PipelineQueue include PipelineQueue
def perform(pipeline_id) def perform(pipeline_id)
Ci::Pipeline.find_by(id: pipeline_id). Ci::Pipeline.find_by(id: pipeline_id)
try(:execute_hooks) .try(:execute_hooks)
end end
end end
...@@ -3,7 +3,7 @@ class PipelineProcessWorker ...@@ -3,7 +3,7 @@ class PipelineProcessWorker
include PipelineQueue include PipelineQueue
def perform(pipeline_id) def perform(pipeline_id)
Ci::Pipeline.find_by(id: pipeline_id). Ci::Pipeline.find_by(id: pipeline_id)
try(:process!) .try(:process!)
end end
end end
...@@ -4,9 +4,9 @@ class PipelineSuccessWorker ...@@ -4,9 +4,9 @@ class PipelineSuccessWorker
def perform(pipeline_id) def perform(pipeline_id)
Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline| Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline|
MergeRequests::MergeWhenPipelineSucceedsService. MergeRequests::MergeWhenPipelineSucceedsService
new(pipeline.project, nil). .new(pipeline.project, nil)
trigger(pipeline) .trigger(pipeline)
end end
end end
end end
...@@ -3,7 +3,7 @@ class PipelineUpdateWorker ...@@ -3,7 +3,7 @@ class PipelineUpdateWorker
include PipelineQueue include PipelineQueue
def perform(pipeline_id) def perform(pipeline_id)
Ci::Pipeline.find_by(id: pipeline_id). Ci::Pipeline.find_by(id: pipeline_id)
try(:update_status) .try(:update_status)
end end
end end
...@@ -193,13 +193,13 @@ module API ...@@ -193,13 +193,13 @@ module API
} }
if params[:merge_when_build_succeeds] && merge_request.head_pipeline && merge_request.head_pipeline.active? if params[:merge_when_build_succeeds] && merge_request.head_pipeline && merge_request.head_pipeline.active?
::MergeRequests::MergeWhenPipelineSucceedsService. ::MergeRequests::MergeWhenPipelineSucceedsService
new(merge_request.target_project, current_user, merge_params). .new(merge_request.target_project, current_user, merge_params)
execute(merge_request) .execute(merge_request)
else else
::MergeRequests::MergeService. ::MergeRequests::MergeService
new(merge_request.target_project, current_user, merge_params). .new(merge_request.target_project, current_user, merge_params)
execute(merge_request) .execute(merge_request)
end end
present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project
...@@ -213,9 +213,9 @@ module API ...@@ -213,9 +213,9 @@ module API
unauthorized! unless merge_request.can_cancel_merge_when_build_succeeds?(current_user) unauthorized! unless merge_request.can_cancel_merge_when_build_succeeds?(current_user)
::MergeRequest::MergeWhenPipelineSucceedsService. ::MergeRequest::MergeWhenPipelineSucceedsService
new(merge_request.target_project, current_user). .new(merge_request.target_project, current_user)
cancel(merge_request) .cancel(merge_request)
end end
desc 'Get the comments of a merge request' do desc 'Get the comments of a merge request' do
......
...@@ -36,8 +36,8 @@ module API ...@@ -36,8 +36,8 @@ module API
new_pipeline = Ci::CreatePipelineService.new(user_project, new_pipeline = Ci::CreatePipelineService.new(user_project,
current_user, current_user,
declared_params(include_missing: false)). declared_params(include_missing: false))
execute(ignore_skip_ci: true, save_on_errors: false) .execute(ignore_skip_ci: true, save_on_errors: false)
if new_pipeline.persisted? if new_pipeline.persisted?
present new_pipeline, with: Entities::Pipeline present new_pipeline, with: Entities::Pipeline
else else
......
...@@ -200,13 +200,13 @@ module API ...@@ -200,13 +200,13 @@ module API
} }
if params[:merge_when_build_succeeds] && merge_request.head_pipeline && merge_request.head_pipeline.active? if params[:merge_when_build_succeeds] && merge_request.head_pipeline && merge_request.head_pipeline.active?
::MergeRequests::MergeWhenPipelineSucceedsService. ::MergeRequests::MergeWhenPipelineSucceedsService
new(merge_request.target_project, current_user, merge_params). .new(merge_request.target_project, current_user, merge_params)
execute(merge_request) .execute(merge_request)
else else
::MergeRequests::MergeService. ::MergeRequests::MergeService
new(merge_request.target_project, current_user, merge_params). .new(merge_request.target_project, current_user, merge_params)
execute(merge_request) .execute(merge_request)
end end
present merge_request, with: ::API::Entities::MergeRequest, current_user: current_user, project: user_project present merge_request, with: ::API::Entities::MergeRequest, current_user: current_user, project: user_project
...@@ -220,9 +220,9 @@ module API ...@@ -220,9 +220,9 @@ module API
unauthorized! unless merge_request.can_cancel_merge_when_build_succeeds?(current_user) unauthorized! unless merge_request.can_cancel_merge_when_build_succeeds?(current_user)
::MergeRequest::MergeWhenPipelineSucceedsService. ::MergeRequest::MergeWhenPipelineSucceedsService
new(merge_request.target_project, current_user). .new(merge_request.target_project, current_user)
cancel(merge_request) .cancel(merge_request)
end end
desc 'Get the comments of a merge request' do desc 'Get the comments of a merge request' do
......
...@@ -3,8 +3,8 @@ module Banzai ...@@ -3,8 +3,8 @@ module Banzai
class WikiPipeline < FullPipeline class WikiPipeline < FullPipeline
def self.filters def self.filters
@filters ||= begin @filters ||= begin
super.insert_after(Filter::TableOfContentsFilter, Filter::GollumTagsFilter). super.insert_after(Filter::TableOfContentsFilter, Filter::GollumTagsFilter)
insert_before(Filter::TaskListFilter, Filter::WikiLinkFilter) .insert_before(Filter::TaskListFilter, Filter::WikiLinkFilter)
end end
end end
end end
......
...@@ -28,8 +28,8 @@ module Banzai ...@@ -28,8 +28,8 @@ module Banzai
# text blobs to parse. # text blobs to parse.
return [] if @texts_and_contexts.empty? return [] if @texts_and_contexts.empty?
@html_documents ||= Renderer.cache_collection_render(@texts_and_contexts). @html_documents ||= Renderer.cache_collection_render(@texts_and_contexts)
map { |html| Nokogiri::HTML.fragment(html) } .map { |html| Nokogiri::HTML.fragment(html) }
end end
end end
end end
...@@ -115,8 +115,8 @@ module Ci ...@@ -115,8 +115,8 @@ module Ci
end end
def yaml_variables(name) def yaml_variables(name)
variables = (@variables || {}). variables = (@variables || {})
merge(job_variables(name)) .merge(job_variables(name))
variables.map do |key, value| variables.map do |key, value|
{ key: key.to_s, value: value, public: true } { key: key.to_s, value: value, public: true }
......
...@@ -19,9 +19,9 @@ module Gitlab ...@@ -19,9 +19,9 @@ module Gitlab
end end
def status def status
@project.pipelines. @project.pipelines
where(sha: @sha). .where(sha: @sha)
latest_status(@ref) || 'unknown' .latest_status(@ref) || 'unknown'
end end
def metadata def metadata
......
...@@ -42,9 +42,9 @@ module Gitlab ...@@ -42,9 +42,9 @@ module Gitlab
if @job.blank? if @job.blank?
@pipeline.coverage @pipeline.coverage
else else
@pipeline.builds. @pipeline.builds
find_by(name: @job). .find_by(name: @job)
try(:coverage) .try(:coverage)
end end
end end
end end
......
...@@ -48,10 +48,10 @@ module Gitlab ...@@ -48,10 +48,10 @@ module Gitlab
return users[username] if users.key?(username) return users[username] if users.key?(username)
users[username] = User.select(:id). users[username] = User.select(:id)
joins(:identities). .joins(:identities)
find_by("identities.extern_uid = ? AND identities.provider = 'bitbucket'", username). .find_by("identities.extern_uid = ? AND identities.provider = 'bitbucket'", username)
try(:id) .try(:id)
end end
def repo def repo
......
...@@ -8,10 +8,10 @@ module Gitlab ...@@ -8,10 +8,10 @@ module Gitlab
end end
def match? def match?
@project.merge_requests. @project.merge_requests
with_state(:locked). .with_state(:locked)
where(in_progress_merge_commit_sha: @newrev, target_branch: @branch_name). .where(in_progress_merge_commit_sha: @newrev, target_branch: @branch_name)
exists? .exists?
end end
end end
end end
......
...@@ -27,9 +27,9 @@ module Gitlab ...@@ -27,9 +27,9 @@ module Gitlab
return unless valid? return unless valid?
self.class.nodes.each do |key, factory| self.class.nodes.each do |key, factory|
factory. factory
value(@config[key]). .value(@config[key])
with(key: key, parent: self) .with(key: key, parent: self)
@entries[key] = factory.create! @entries[key] = factory.create!
end end
...@@ -49,8 +49,8 @@ module Gitlab ...@@ -49,8 +49,8 @@ module Gitlab
private # rubocop:disable Lint/UselessAccessModifier private # rubocop:disable Lint/UselessAccessModifier
def entry(key, entry, metadata) def entry(key, entry, metadata)
factory = Entry::Factory.new(entry). factory = Entry::Factory.new(entry)
with(description: metadata[:description]) .with(description: metadata[:description])
(@nodes ||= {}).merge!(key.to_sym => factory) (@nodes ||= {}).merge!(key.to_sym => factory)
end end
......
...@@ -46,9 +46,9 @@ module Gitlab ...@@ -46,9 +46,9 @@ module Gitlab
private private
def compose_jobs! def compose_jobs!
factory = Entry::Factory.new(Entry::Jobs). factory = Entry::Factory.new(Entry::Jobs)
value(@config.except(*self.class.nodes.keys)). .value(@config.except(*self.class.nodes.keys))
with(key: :jobs, parent: self, .with(key: :jobs, parent: self,
description: 'Jobs definition for this pipeline') description: 'Jobs definition for this pipeline')
@entries[:jobs] = factory.create! @entries[:jobs] = factory.create!
......
...@@ -31,10 +31,10 @@ module Gitlab ...@@ -31,10 +31,10 @@ module Gitlab
@config.each do |name, config| @config.each do |name, config|
node = hidden?(name) ? Entry::Hidden : Entry::Job node = hidden?(name) ? Entry::Hidden : Entry::Job
factory = Entry::Factory.new(node). factory = Entry::Factory.new(node)
value(config || {}). .value(config || {})
metadata(name: name). .metadata(name: name)
with(key: name, parent: self, .with(key: name, parent: self,
description: "#{name} job definition.") description: "#{name} job definition.")
@entries[name] = factory.create! @entries[name] = factory.create!
......
...@@ -17,10 +17,10 @@ module Gitlab ...@@ -17,10 +17,10 @@ module Gitlab
end end
def core_status def core_status
Gitlab::Ci::Status. Gitlab::Ci::Status
const_get(@status.capitalize). .const_get(@status.capitalize)
new(@subject, @user). .new(@subject, @user)
extend(self.class.common_helpers) .extend(self.class.common_helpers)
end end
def compound_extended_status def compound_extended_status
......
...@@ -41,8 +41,8 @@ module Gitlab ...@@ -41,8 +41,8 @@ module Gitlab
chunks.unshift(buf) chunks.unshift(buf)
end end
chunks.join.lines.last(max_lines).join. chunks.join.lines.last(max_lines).join
force_encoding(Encoding.default_external) .force_encoding(Encoding.default_external)
end end
end end
end end
......
...@@ -49,9 +49,9 @@ module Gitlab ...@@ -49,9 +49,9 @@ module Gitlab
private private
def clean(message) def clean(message)
message.encode("UTF-16BE", undef: :replace, invalid: :replace, replace: ""). message.encode("UTF-16BE", undef: :replace, invalid: :replace, replace: "")
encode("UTF-8"). .encode("UTF-8")
gsub("\0".encode("UTF-8"), "") .gsub("\0".encode("UTF-8"), "")
end end
end end
end end
......
...@@ -178,9 +178,9 @@ module Gitlab ...@@ -178,9 +178,9 @@ module Gitlab
def apply_labels(issuable, raw) def apply_labels(issuable, raw)
return unless raw.labels.count > 0 return unless raw.labels.count > 0
label_ids = raw.labels. label_ids = raw.labels
map { |attrs| @labels[attrs.name] }. .map { |attrs| @labels[attrs.name] }
compact .compact
issuable.update_attribute(:label_ids, label_ids) issuable.update_attribute(:label_ids, label_ids)
end end
......
...@@ -25,8 +25,8 @@ module Gitlab ...@@ -25,8 +25,8 @@ module Gitlab
def find_by_email def find_by_email
return nil unless email return nil unless email
User.find_by_any_email(email). User.find_by_any_email(email)
try(:id) .try(:id)
end end
def find_by_external_uid def find_by_external_uid
...@@ -34,11 +34,11 @@ module Gitlab ...@@ -34,11 +34,11 @@ module Gitlab
identities = ::Identity.arel_table identities = ::Identity.arel_table
User.select(:id). User.select(:id)
joins(:identities).where(identities[:provider].eq(:github). .joins(:identities).where(identities[:provider].eq(:github)
and(identities[:extern_uid].eq(id))). .and(identities[:extern_uid].eq(id)))
first. .first
try(:id) .try(:id)
end end
end end
end end
......
...@@ -25,12 +25,12 @@ module RuboCop ...@@ -25,12 +25,12 @@ module RuboCop
private private
def gemfile?(node) def gemfile?(node)
node. node
location. .location
expression. .expression
source_buffer. .source_buffer
name. .name
end_with?("Gemfile") .end_with?("Gemfile")
end end
end end
end end
......
...@@ -33,8 +33,8 @@ describe Ci::ProjectsController do ...@@ -33,8 +33,8 @@ describe Ci::ProjectsController do
shared_examples 'badge provider' do shared_examples 'badge provider' do
it 'shows badge' do it 'shows badge' do
expect(response.status).to eq 200 expect(response.status).to eq 200
expect(response.headers). expect(response.headers)
to include('Content-Type' => 'image/svg+xml') .to include('Content-Type' => 'image/svg+xml')
end end
end end
......
...@@ -335,9 +335,9 @@ describe Projects::MergeRequestsController do ...@@ -335,9 +335,9 @@ describe Projects::MergeRequestsController do
it 'sets the MR to merge when the build succeeds' do it 'sets the MR to merge when the build succeeds' do
service = double(:merge_when_build_succeeds_service) service = double(:merge_when_build_succeeds_service)
expect(MergeRequests::MergeWhenPipelineSucceedsService). expect(MergeRequests::MergeWhenPipelineSucceedsService)
to receive(:new).with(project, anything, anything). .to receive(:new).with(project, anything, anything)
and_return(service) .and_return(service)
expect(service).to receive(:execute).with(merge_request) expect(service).to receive(:execute).with(merge_request)
merge_when_build_succeeds merge_when_build_succeeds
......
...@@ -11,8 +11,8 @@ describe SessionsController do ...@@ -11,8 +11,8 @@ describe SessionsController do
it 'does not authenticate user' do it 'does not authenticate user' do
post(:create, user: { login: 'invalid', password: 'invalid' }) post(:create, user: { login: 'invalid', password: 'invalid' })
expect(response). expect(response)
to set_flash.now[:alert].to /Invalid Login or password/ .to set_flash.now[:alert].to /Invalid Login or password/
end end
end end
...@@ -102,8 +102,8 @@ describe SessionsController do ...@@ -102,8 +102,8 @@ describe SessionsController do
end end
it 'warns about invalid OTP code' do it 'warns about invalid OTP code' do
expect(response).to set_flash.now[:alert]. expect(response).to set_flash.now[:alert]
to /Invalid two-factor code/ .to /Invalid two-factor code/
end end
end end
end end
...@@ -129,8 +129,8 @@ describe SessionsController do ...@@ -129,8 +129,8 @@ describe SessionsController do
end end
it 'warns about invalid login' do it 'warns about invalid login' do
expect(response).to set_flash.now[:alert]. expect(response).to set_flash.now[:alert]
to /Invalid Login or password/ .to /Invalid Login or password/
end end
it 'locks the user' do it 'locks the user' do
...@@ -140,8 +140,8 @@ describe SessionsController do ...@@ -140,8 +140,8 @@ describe SessionsController do
it 'keeps the user locked on future login attempts' do it 'keeps the user locked on future login attempts' do
post(:create, user: { login: user.username, password: user.password }) post(:create, user: { login: user.username, password: user.password })
expect(response). expect(response)
to set_flash.now[:alert].to /Invalid Login or password/ .to set_flash.now[:alert].to /Invalid Login or password/
end end
end end
end end
...@@ -153,8 +153,8 @@ describe SessionsController do ...@@ -153,8 +153,8 @@ describe SessionsController do
authenticate_2fa(login: another_user.username, authenticate_2fa(login: another_user.username,
otp_attempt: 'invalid') otp_attempt: 'invalid')
expect(response).to set_flash.now[:alert]. expect(response).to set_flash.now[:alert]
to /Invalid two-factor code/ .to /Invalid two-factor code/
end end
end end
end end
......
...@@ -111,8 +111,8 @@ feature 'Environments page', :feature, :js do ...@@ -111,8 +111,8 @@ feature 'Environments page', :feature, :js do
find('.js-dropdown-play-icon-container').click find('.js-dropdown-play-icon-container').click
expect(page).to have_content(manual.name.humanize) expect(page).to have_content(manual.name.humanize)
expect { click_link(manual.name.humanize) }. expect { click_link(manual.name.humanize) }
not_to change { Ci::Pipeline.count } .not_to change { Ci::Pipeline.count }
expect(manual.reload).to be_pending expect(manual.reload).to be_pending
end end
......
...@@ -61,8 +61,8 @@ feature 'Merge request created from fork' do ...@@ -61,8 +61,8 @@ feature 'Merge request created from fork' do
expect(page).to have_content pipeline.id expect(page).to have_content pipeline.id
end end
expect(page.find('a.btn-remove')[:href]). expect(page.find('a.btn-remove')[:href])
to include fork_project.path_with_namespace .to include fork_project.path_with_namespace
end end
end end
......
...@@ -366,8 +366,8 @@ describe 'Pipelines', :feature, :js do ...@@ -366,8 +366,8 @@ describe 'Pipelines', :feature, :js do
before { stub_ci_pipeline_to_return_yaml_file } before { stub_ci_pipeline_to_return_yaml_file }
it 'creates a new pipeline' do it 'creates a new pipeline' do
expect { click_on 'Create pipeline' }. expect { click_on 'Create pipeline' }
to change { Ci::Pipeline.count }.by(1) .to change { Ci::Pipeline.count }.by(1)
end end
end end
......
...@@ -16,18 +16,18 @@ describe EnvironmentsFinder do ...@@ -16,18 +16,18 @@ describe EnvironmentsFinder do
end end
it 'returns environment when with_tags is set' do it 'returns environment when with_tags is set' do
expect(described_class.new(project, user, ref: 'master', commit: project.commit, with_tags: true).execute). expect(described_class.new(project, user, ref: 'master', commit: project.commit, with_tags: true).execute)
to contain_exactly(environment) .to contain_exactly(environment)
end end
it 'does not return environment when no with_tags is set' do it 'does not return environment when no with_tags is set' do
expect(described_class.new(project, user, ref: 'master', commit: project.commit).execute). expect(described_class.new(project, user, ref: 'master', commit: project.commit).execute)
to be_empty .to be_empty
end end
it 'does not return environment when commit is not part of deployment' do it 'does not return environment when commit is not part of deployment' do
expect(described_class.new(project, user, ref: 'master', commit: project.commit('feature')).execute). expect(described_class.new(project, user, ref: 'master', commit: project.commit('feature')).execute)
to be_empty .to be_empty
end end
end end
...@@ -37,23 +37,23 @@ describe EnvironmentsFinder do ...@@ -37,23 +37,23 @@ describe EnvironmentsFinder do
end end
it 'returns environment when ref is set' do it 'returns environment when ref is set' do
expect(described_class.new(project, user, ref: 'master', commit: project.commit).execute). expect(described_class.new(project, user, ref: 'master', commit: project.commit).execute)
to contain_exactly(environment) .to contain_exactly(environment)
end end
it 'does not environment when ref is different' do it 'does not environment when ref is different' do
expect(described_class.new(project, user, ref: 'feature', commit: project.commit).execute). expect(described_class.new(project, user, ref: 'feature', commit: project.commit).execute)
to be_empty .to be_empty
end end
it 'does not return environment when commit is not part of deployment' do it 'does not return environment when commit is not part of deployment' do
expect(described_class.new(project, user, ref: 'master', commit: project.commit('feature')).execute). expect(described_class.new(project, user, ref: 'master', commit: project.commit('feature')).execute)
to be_empty .to be_empty
end end
it 'returns environment when commit constraint is not set' do it 'returns environment when commit constraint is not set' do
expect(described_class.new(project, user, ref: 'master').execute). expect(described_class.new(project, user, ref: 'master').execute)
to contain_exactly(environment) .to contain_exactly(environment)
end end
end end
...@@ -63,8 +63,8 @@ describe EnvironmentsFinder do ...@@ -63,8 +63,8 @@ describe EnvironmentsFinder do
end end
it 'returns environment' do it 'returns environment' do
expect(described_class.new(project, user, commit: project.commit).execute). expect(described_class.new(project, user, commit: project.commit).execute)
to contain_exactly(environment) .to contain_exactly(environment)
end end
end end
...@@ -75,8 +75,8 @@ describe EnvironmentsFinder do ...@@ -75,8 +75,8 @@ describe EnvironmentsFinder do
end end
it 'finds recently updated environment' do it 'finds recently updated environment' do
expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute). expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute)
to contain_exactly(environment) .to contain_exactly(environment)
end end
end end
...@@ -87,8 +87,8 @@ describe EnvironmentsFinder do ...@@ -87,8 +87,8 @@ describe EnvironmentsFinder do
end end
it 'does not find environment' do it 'does not find environment' do
expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute). expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute)
to be_empty .to be_empty
end end
end end
...@@ -101,8 +101,8 @@ describe EnvironmentsFinder do ...@@ -101,8 +101,8 @@ describe EnvironmentsFinder do
end end
it 'finds both environments' do it 'finds both environments' do
expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute). expect(described_class.new(project, user, ref: 'feature', recently_updated: true).execute)
to contain_exactly(environment, second_environment) .to contain_exactly(environment, second_environment)
end end
end end
end end
......
...@@ -67,8 +67,8 @@ describe IssuesHelper do ...@@ -67,8 +67,8 @@ describe IssuesHelper do
user = build_stubbed(:user, name: 'Joe') user = build_stubbed(:user, name: 'Joe')
awards = Array.new(3, build_stubbed(:award_emoji, user: user)) awards = Array.new(3, build_stubbed(:award_emoji, user: user))
expect(award_user_list(awards, nil, limit: 3)). expect(award_user_list(awards, nil, limit: 3))
to eq('Joe, Joe, and Joe') .to eq('Joe, Joe, and Joe')
end end
it "displays the current user's name as 'You'" do it "displays the current user's name as 'You'" do
...@@ -83,8 +83,8 @@ describe IssuesHelper do ...@@ -83,8 +83,8 @@ describe IssuesHelper do
user = build_stubbed(:user, name: 'Jane') user = build_stubbed(:user, name: 'Jane')
awards = Array.new(5, build_stubbed(:award_emoji, user: user)) awards = Array.new(5, build_stubbed(:award_emoji, user: user))
expect(award_user_list(awards, nil, limit: 3)). expect(award_user_list(awards, nil, limit: 3))
to eq('Jane, Jane, Jane, and 2 more.') .to eq('Jane, Jane, Jane, and 2 more.')
end end
it "displays the current user in front of other users" do it "displays the current user in front of other users" do
......
...@@ -111,8 +111,8 @@ describe PageLayoutHelper do ...@@ -111,8 +111,8 @@ describe PageLayoutHelper do
end end
it 'escapes content' do it 'escapes content' do
allow(helper).to receive(:page_card_attributes). allow(helper).to receive(:page_card_attributes)
and_return(foo: %q{foo" http-equiv="refresh}.html_safe) .and_return(foo: %q{foo" http-equiv="refresh}.html_safe)
tags = helper.page_card_meta_tags tags = helper.page_card_meta_tags
......
...@@ -9,52 +9,52 @@ describe VisibilityLevelHelper do ...@@ -9,52 +9,52 @@ describe VisibilityLevelHelper do
describe 'visibility_level_description' do describe 'visibility_level_description' do
context 'used with a Project' do context 'used with a Project' do
it 'delegates projects to #project_visibility_level_description' do it 'delegates projects to #project_visibility_level_description' do
expect(visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project)). expect(visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project))
to match /project/i .to match /project/i
end end
end end
context 'used with a Group' do context 'used with a Group' do
it 'delegates groups to #group_visibility_level_description' do it 'delegates groups to #group_visibility_level_description' do
expect(visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, group)). expect(visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, group))
to match /group/i .to match /group/i
end end
end end
context 'called with a Snippet' do context 'called with a Snippet' do
it 'delegates snippets to #snippet_visibility_level_description' do it 'delegates snippets to #snippet_visibility_level_description' do
expect(visibility_level_description(Gitlab::VisibilityLevel::INTERNAL, project_snippet)). expect(visibility_level_description(Gitlab::VisibilityLevel::INTERNAL, project_snippet))
to match /snippet/i .to match /snippet/i
end end
end end
end end
describe "#project_visibility_level_description" do describe "#project_visibility_level_description" do
it "describes private projects" do it "describes private projects" do
expect(project_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE)). expect(project_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE))
to eq "Project access must be granted explicitly to each user." .to eq "Project access must be granted explicitly to each user."
end end
it "describes public projects" do it "describes public projects" do
expect(project_visibility_level_description(Gitlab::VisibilityLevel::PUBLIC)). expect(project_visibility_level_description(Gitlab::VisibilityLevel::PUBLIC))
to eq "The project can be cloned without any authentication." .to eq "The project can be cloned without any authentication."
end end
end end
describe "#snippet_visibility_level_description" do describe "#snippet_visibility_level_description" do
it 'describes visibility only for me' do it 'describes visibility only for me' do
expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, personal_snippet)). expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, personal_snippet))
to eq "The snippet is visible only to me." .to eq "The snippet is visible only to me."
end end
it 'describes visibility for project members' do it 'describes visibility for project members' do
expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project_snippet)). expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project_snippet))
to eq "The snippet is visible only to project members." .to eq "The snippet is visible only to project members."
end end
it 'defaults to personal snippet' do it 'defaults to personal snippet' do
expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE)). expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE))
to eq "The snippet is visible only to me." .to eq "The snippet is visible only to me."
end end
end end
......
...@@ -37,8 +37,8 @@ describe API::Helpers::Pagination do ...@@ -37,8 +37,8 @@ describe API::Helpers::Pagination do
describe 'first page' do describe 'first page' do
before do before do
allow(subject).to receive(:params). allow(subject).to receive(:params)
and_return({ page: 1, per_page: 2 }) .and_return({ page: 1, per_page: 2 })
end end
it 'returns appropriate amount of resources' do it 'returns appropriate amount of resources' do
...@@ -60,8 +60,8 @@ describe API::Helpers::Pagination do ...@@ -60,8 +60,8 @@ describe API::Helpers::Pagination do
describe 'second page' do describe 'second page' do
before do before do
allow(subject).to receive(:params). allow(subject).to receive(:params)
and_return({ page: 2, per_page: 2 }) .and_return({ page: 2, per_page: 2 })
end end
it 'returns appropriate amount of resources' do it 'returns appropriate amount of resources' do
...@@ -87,8 +87,8 @@ describe API::Helpers::Pagination do ...@@ -87,8 +87,8 @@ describe API::Helpers::Pagination do
end end
def expect_message(method) def expect_message(method)
expect(subject).to receive(method). expect(subject).to receive(method)
at_least(:once).and_return(value) .at_least(:once).and_return(value)
end end
end end
end end
...@@ -33,8 +33,8 @@ describe Banzai::Filter::ExternalIssueReferenceFilter, lib: true do ...@@ -33,8 +33,8 @@ describe Banzai::Filter::ExternalIssueReferenceFilter, lib: true do
doc = filter("Issue #{reference}") doc = filter("Issue #{reference}")
issue_id = doc.css('a').first.attr("data-external-issue") issue_id = doc.css('a').first.attr("data-external-issue")
expect(doc.css('a').first.attr('href')). expect(doc.css('a').first.attr('href'))
to eq helper.url_for_issue(issue_id, project) .to eq helper.url_for_issue(issue_id, project)
end end
it 'links to the external tracker' do it 'links to the external tracker' do
......
...@@ -372,8 +372,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do ...@@ -372,8 +372,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
let!(:result) { reference_filter("See #{reference}") } let!(:result) { reference_filter("See #{reference}") }
it 'links to a valid reference' do it 'links to a valid reference' do
expect(result.css('a').first.attr('href')). expect(result.css('a').first.attr('href'))
to eq urls.namespace_project_issues_url(project2.namespace, .to eq urls.namespace_project_issues_url(project2.namespace,
project2, project2,
label_name: label.name) label_name: label.name)
end end
...@@ -406,8 +406,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do ...@@ -406,8 +406,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
let!(:result) { reference_filter("See #{reference}") } let!(:result) { reference_filter("See #{reference}") }
it 'links to a valid reference' do it 'links to a valid reference' do
expect(result.css('a').first.attr('href')). expect(result.css('a').first.attr('href'))
to eq urls.namespace_project_issues_url(project2.namespace, .to eq urls.namespace_project_issues_url(project2.namespace,
project2, project2,
label_name: label.name) label_name: label.name)
end end
...@@ -440,8 +440,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do ...@@ -440,8 +440,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
let!(:result) { reference_filter("See #{reference}") } let!(:result) { reference_filter("See #{reference}") }
it 'links to a valid reference' do it 'links to a valid reference' do
expect(result.css('a').first.attr('href')). expect(result.css('a').first.attr('href'))
to eq urls.namespace_project_issues_url(project2.namespace, .to eq urls.namespace_project_issues_url(project2.namespace,
project2, project2,
label_name: label.name) label_name: label.name)
end end
...@@ -476,8 +476,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do ...@@ -476,8 +476,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
let!(:result) { reference_filter("See #{reference}", project: project) } let!(:result) { reference_filter("See #{reference}", project: project) }
it 'points to referenced project issues page' do it 'points to referenced project issues page' do
expect(result.css('a').first.attr('href')). expect(result.css('a').first.attr('href'))
to eq urls.namespace_project_issues_url(another_project.namespace, .to eq urls.namespace_project_issues_url(another_project.namespace,
another_project, another_project,
label_name: group_label.name) label_name: group_label.name)
end end
...@@ -549,15 +549,15 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do ...@@ -549,15 +549,15 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
let!(:result) { reference_filter("See #{reference}", project: project) } let!(:result) { reference_filter("See #{reference}", project: project) }
it 'points to referenced project issues page' do it 'points to referenced project issues page' do
expect(result.css('a').first.attr('href')). expect(result.css('a').first.attr('href'))
to eq urls.namespace_project_issues_url(project.namespace, .to eq urls.namespace_project_issues_url(project.namespace,
project, project,
label_name: group_label.name) label_name: group_label.name)
end end
it 'has valid color' do it 'has valid color' do
expect(result.css('a span').first.attr('style')). expect(result.css('a span').first.attr('style'))
to match /background-color: #00ff00/ .to match /background-color: #00ff00/
end end
it 'has valid link text' do it 'has valid link text' do
...@@ -583,8 +583,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do ...@@ -583,8 +583,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
let!(:result) { reference_filter("See #{reference}", project: project) } let!(:result) { reference_filter("See #{reference}", project: project) }
it 'points to referenced project issues page' do it 'points to referenced project issues page' do
expect(result.css('a').first.attr('href')). expect(result.css('a').first.attr('href'))
to eq urls.namespace_project_issues_url(project.namespace, .to eq urls.namespace_project_issues_url(project.namespace,
project, project,
label_name: group_label.name) label_name: group_label.name)
end end
......
...@@ -37,8 +37,8 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do ...@@ -37,8 +37,8 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do
doc = reference_filter("Hey #{reference}", author: user) doc = reference_filter("Hey #{reference}", author: user)
expect(doc.css('a').length).to eq 1 expect(doc.css('a').length).to eq 1
expect(doc.css('a').first.attr('href')). expect(doc.css('a').first.attr('href'))
to eq urls.namespace_project_url(project.namespace, project) .to eq urls.namespace_project_url(project.namespace, project)
end end
it 'includes a data-author attribute when there is an author' do it 'includes a data-author attribute when there is an author' do
......
...@@ -25,8 +25,8 @@ module Ci ...@@ -25,8 +25,8 @@ module Ci
end end
it 'includes coverage regexp in build attributes' do it 'includes coverage regexp in build attributes' do
expect(subject). expect(subject)
to include(coverage_regex: 'Code coverage: \d+\.\d+') .to include(coverage_regex: 'Code coverage: \d+\.\d+')
end end
end end
end end
...@@ -584,8 +584,8 @@ module Ci ...@@ -584,8 +584,8 @@ module Ci
end end
it 'raises error' do it 'raises error' do
expect { subject }. expect { subject }
to raise_error(GitlabCiYamlProcessor::ValidationError, .to raise_error(GitlabCiYamlProcessor::ValidationError,
/jobs:rspec:variables config should be a hash of key value pairs/) /jobs:rspec:variables config should be a hash of key value pairs/)
end end
end end
...@@ -1365,8 +1365,8 @@ EOT ...@@ -1365,8 +1365,8 @@ EOT
it "returns an error about invalid configutaion" do it "returns an error about invalid configutaion" do
content = YAML.dump("invalid: yaml: test") content = YAML.dump("invalid: yaml: test")
expect(GitlabCiYamlProcessor.validation_message(content)). expect(GitlabCiYamlProcessor.validation_message(content))
to eq "Invalid configuration format" .to eq "Invalid configuration format"
end end
end end
...@@ -1374,15 +1374,15 @@ EOT ...@@ -1374,15 +1374,15 @@ EOT
it "returns an error about invalid tags" do it "returns an error about invalid tags" do
content = YAML.dump({ rspec: { script: "test", tags: "mysql" } }) content = YAML.dump({ rspec: { script: "test", tags: "mysql" } })
expect(GitlabCiYamlProcessor.validation_message(content)). expect(GitlabCiYamlProcessor.validation_message(content))
to eq "jobs:rspec tags should be an array of strings" .to eq "jobs:rspec tags should be an array of strings"
end end
end end
context "when YAML content is empty" do context "when YAML content is empty" do
it "returns an error about missing content" do it "returns an error about missing content" do
expect(GitlabCiYamlProcessor.validation_message('')). expect(GitlabCiYamlProcessor.validation_message(''))
to eq "Please provide content of .gitlab-ci.yml" .to eq "Please provide content of .gitlab-ci.yml"
end end
end end
......
...@@ -19,8 +19,8 @@ module Gitlab ...@@ -19,8 +19,8 @@ module Gitlab
attributes: described_class::DEFAULT_ADOC_ATTRS attributes: described_class::DEFAULT_ADOC_ATTRS
} }
expect(Asciidoctor).to receive(:convert). expect(Asciidoctor).to receive(:convert)
with(input, expected_asciidoc_opts).and_return(html) .with(input, expected_asciidoc_opts).and_return(html)
expect( render(input, context) ).to eql html expect( render(input, context) ).to eql html
end end
...@@ -35,8 +35,8 @@ module Gitlab ...@@ -35,8 +35,8 @@ module Gitlab
attributes: described_class::DEFAULT_ADOC_ATTRS + ['foo'] attributes: described_class::DEFAULT_ADOC_ATTRS + ['foo']
} }
expect(Asciidoctor).to receive(:convert). expect(Asciidoctor).to receive(:convert)
with(input, expected_asciidoc_opts).and_return(html) .with(input, expected_asciidoc_opts).and_return(html)
render(input, context, asciidoc_opts) render(input, context, asciidoc_opts)
end end
......
...@@ -140,8 +140,8 @@ describe Gitlab::Auth, lib: true do ...@@ -140,8 +140,8 @@ describe Gitlab::Auth, lib: true do
password: 'my-secret', password: 'my-secret',
) )
expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')). expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip'))
to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) .to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities))
end end
it 'falls through oauth authentication when the username is oauth2' do it 'falls through oauth authentication when the username is oauth2' do
...@@ -151,8 +151,8 @@ describe Gitlab::Auth, lib: true do ...@@ -151,8 +151,8 @@ describe Gitlab::Auth, lib: true do
password: 'my-secret', password: 'my-secret',
) )
expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')). expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip'))
to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) .to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities))
end end
end end
......
...@@ -141,8 +141,8 @@ describe Backup::Manager, lib: true do ...@@ -141,8 +141,8 @@ describe Backup::Manager, lib: true do
it 'fails the operation and prints an error' do it 'fails the operation and prints an error' do
expect { subject.unpack }.to raise_error SystemExit expect { subject.unpack }.to raise_error SystemExit
expect(progress).to have_received(:puts). expect(progress).to have_received(:puts)
with(a_string_matching('No backups found')) .with(a_string_matching('No backups found'))
end end
end end
...@@ -158,8 +158,8 @@ describe Backup::Manager, lib: true do ...@@ -158,8 +158,8 @@ describe Backup::Manager, lib: true do
it 'fails the operation and prints an error' do it 'fails the operation and prints an error' do
expect { subject.unpack }.to raise_error SystemExit expect { subject.unpack }.to raise_error SystemExit
expect(progress).to have_received(:puts). expect(progress).to have_received(:puts)
with(a_string_matching('Found more than one backup')) .with(a_string_matching('Found more than one backup'))
end end
end end
...@@ -178,8 +178,8 @@ describe Backup::Manager, lib: true do ...@@ -178,8 +178,8 @@ describe Backup::Manager, lib: true do
it 'fails the operation and prints an error' do it 'fails the operation and prints an error' do
expect { subject.unpack }.to raise_error SystemExit expect { subject.unpack }.to raise_error SystemExit
expect(File).to have_received(:exist?).with('wrong_gitlab_backup.tar') expect(File).to have_received(:exist?).with('wrong_gitlab_backup.tar')
expect(progress).to have_received(:puts). expect(progress).to have_received(:puts)
with(a_string_matching('The backup file wrong_gitlab_backup.tar does not exist')) .with(a_string_matching('The backup file wrong_gitlab_backup.tar does not exist'))
end end
end end
...@@ -200,8 +200,8 @@ describe Backup::Manager, lib: true do ...@@ -200,8 +200,8 @@ describe Backup::Manager, lib: true do
it 'unpacks the file' do it 'unpacks the file' do
subject.unpack subject.unpack
expect(Kernel).to have_received(:system). expect(Kernel).to have_received(:system)
with("tar", "-xf", "1451606400_2016_01_01_gitlab_backup.tar") .with("tar", "-xf", "1451606400_2016_01_01_gitlab_backup.tar")
expect(progress).to have_received(:puts).with(a_string_matching('done')) expect(progress).to have_received(:puts).with(a_string_matching('done'))
end end
end end
......
...@@ -20,8 +20,8 @@ describe Gitlab::Badge::Build::Status do ...@@ -20,8 +20,8 @@ describe Gitlab::Badge::Build::Status do
describe '#metadata' do describe '#metadata' do
it 'returns badge metadata' do it 'returns badge metadata' do
expect(badge.metadata.image_url). expect(badge.metadata.image_url)
to include 'badges/master/build.svg' .to include 'badges/master/build.svg'
end end
end end
......
...@@ -26,8 +26,8 @@ describe Gitlab::Ci::Config::Entry::Artifacts do ...@@ -26,8 +26,8 @@ describe Gitlab::Ci::Config::Entry::Artifacts do
let(:config) { { name: 10 } } let(:config) { { name: 10 } }
it 'reports error' do it 'reports error' do
expect(entry.errors). expect(entry.errors)
to include 'artifacts name should be a string' .to include 'artifacts name should be a string'
end end
end end
...@@ -35,8 +35,8 @@ describe Gitlab::Ci::Config::Entry::Artifacts do ...@@ -35,8 +35,8 @@ describe Gitlab::Ci::Config::Entry::Artifacts do
let(:config) { { test: 100 } } let(:config) { { test: 100 } }
it 'reports error' do it 'reports error' do
expect(entry.errors). expect(entry.errors)
to include 'artifacts config contains unknown keys: test' .to include 'artifacts config contains unknown keys: test'
end end
end end
end end
......
...@@ -14,9 +14,9 @@ describe Gitlab::Ci::Config::Entry::Attributable do ...@@ -14,9 +14,9 @@ describe Gitlab::Ci::Config::Entry::Attributable do
context 'config is a hash' do context 'config is a hash' do
before do before do
allow(instance). allow(instance)
to receive(:config). .to receive(:config)
and_return({ name: 'some name', test: 'some test' }) .and_return({ name: 'some name', test: 'some test' })
end end
it 'returns the value of config' do it 'returns the value of config' do
...@@ -31,9 +31,9 @@ describe Gitlab::Ci::Config::Entry::Attributable do ...@@ -31,9 +31,9 @@ describe Gitlab::Ci::Config::Entry::Attributable do
context 'config is not a hash' do context 'config is not a hash' do
before do before do
allow(instance). allow(instance)
to receive(:config). .to receive(:config)
and_return('some test') .and_return('some test')
end end
it 'returns nil' do it 'returns nil' do
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment