Commit 0430b764 authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Rémy Coutable
Browse files

Enable Style/DotPosition Rubocop 👮

parent 78ee24ba
......@@ -164,6 +164,11 @@ Style/DefWithParentheses:
Style/Documentation:
Enabled: false
# Multi-line method chaining should be done with leading dots.
Style/DotPosition:
Enabled: true
EnforcedStyle: leading
# This cop checks for uses of double negation (!!) to convert something
# to a boolean value. As this is both cryptic and usually redundant, it
# should be avoided.
......
......@@ -88,13 +88,6 @@ Security/YAMLLoad:
Style/BarePercentLiterals:
Enabled: false
# Offense count: 1403
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: leading, trailing
Style/DotPosition:
Enabled: false
# Offense count: 5
# Cop supports --auto-correct.
Style/EachWithObject:
......
......@@ -97,8 +97,8 @@ def existing_merge_request_path
def merge_request_exists?
return @merge_request if defined?(@merge_request)
@merge_request = MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened.
find_by(source_project_id: @project_to_commit_into, source_branch: @branch_name, target_branch: @start_branch)
@merge_request = MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened
.find_by(source_project_id: @project_to_commit_into, source_branch: @branch_name, target_branch: @start_branch)
end
def different_project?
......
......@@ -15,8 +15,8 @@ def create
end
def destroy
Members::DestroyService.new(membershipable, current_user, params).
execute(:all)
Members::DestroyService.new(membershipable, current_user, params)
.execute(:all)
respond_to do |format|
format.html do
......@@ -42,8 +42,8 @@ def approve_access_request
end
def leave
member = Members::DestroyService.new(membershipable, current_user, user_id: current_user.id).
execute(:all)
member = Members::DestroyService.new(membershipable, current_user, user_id: current_user.id)
.execute(:all)
notice =
if member.request?
......
......@@ -22,8 +22,8 @@ def index
end
def starred
@projects = load_projects(params.merge(starred: true)).
includes(:forked_from_project, :tags).page(params[:page])
@projects = load_projects(params.merge(starred: true))
.includes(:forked_from_project, :tags).page(params[:page])
@groups = []
......@@ -45,8 +45,8 @@ def default_sorting
end
def load_projects(finder_params)
ProjectsFinder.new(params: finder_params, current_user: current_user).
execute.includes(:route, namespace: :route)
ProjectsFinder.new(params: finder_params, current_user: current_user)
.execute.includes(:route, namespace: :route)
end
def load_events
......
......@@ -49,7 +49,7 @@ def starred
private
def load_projects
ProjectsFinder.new(current_user: current_user, params: params).
execute.includes(:route, namespace: :route)
ProjectsFinder.new(current_user: current_user, params: params)
.execute.includes(:route, namespace: :route)
end
end
......@@ -11,8 +11,8 @@ def auth
service = SERVICES[params[:service]]
return head :not_found unless service
result = service.new(@authentication_result.project, @authentication_result.actor, auth_params).
execute(authentication_abilities: @authentication_result.authentication_abilities)
result = service.new(@authentication_result.project, @authentication_result.actor, auth_params)
.execute(authentication_abilities: @authentication_result.authentication_abilities)
render json: result, status: result[:http_status]
end
......
......@@ -144,7 +144,7 @@ def oauth
end
def log_audit_event(user, options = {})
AuditEventService.new(user, user, options).
for_authentication.security_event
AuditEventService.new(user, user, options)
.for_authentication.security_event
end
end
......@@ -49,9 +49,9 @@ def reset_rss_token
end
def audit_log
@events = AuditEvent.where(entity_type: "User", entity_id: current_user.id).
order("created_at DESC").
page(params[:page])
@events = AuditEvent.where(entity_type: "User", entity_id: current_user.id)
.order("created_at DESC")
.page(params[:page])
end
def update_username
......
......@@ -187,7 +187,7 @@ def validate_diff_params
end
def set_last_commit_sha
@last_commit_sha = Gitlab::Git::Commit.
last_for_path(@repository, @ref, @path).sha
@last_commit_sha = Gitlab::Git::Commit
.last_for_path(@repository, @ref, @path).sha
end
end
......@@ -37,8 +37,8 @@ def create
redirect_to_autodeploy = project.empty_repo? && project.deployment_services.present?
result = CreateBranchService.new(project, current_user).
execute(branch_name, ref)
result = CreateBranchService.new(project, current_user)
.execute(branch_name, ref)
if params[:issue_iid]
issue = IssuesFinder.new(current_user, project_id: @project.id).find_by(iid: params[:issue_iid])
......
......@@ -18,11 +18,11 @@ def show
@repository.commits(@ref, path: @path, limit: @limit, offset: @offset)
end
@note_counts = project.notes.where(commit_id: @commits.map(&:id)).
group(:commit_id).count
@note_counts = project.notes.where(commit_id: @commits.map(&:id))
.group(:commit_id).count
@merge_request = MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened.
find_by(source_project: @project, source_branch: @ref, target_branch: @repository.root_ref)
@merge_request = MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened
.find_by(source_project: @project, source_branch: @ref, target_branch: @repository.root_ref)
respond_to do |format|
format.html
......
......@@ -61,7 +61,7 @@ def define_diff_vars
end
def merge_request
@merge_request ||= MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened.
find_by(source_project: @project, source_branch: @head_ref, target_branch: @start_ref)
@merge_request ||= MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened
.find_by(source_project: @project, source_branch: @head_ref, target_branch: @start_ref)
end
end
......@@ -143,8 +143,8 @@ def commits
# Get commits from repository
# or from cache if already merged
@commits = @merge_request.commits
@note_counts = Note.where(commit_id: @commits.map(&:id)).
group(:commit_id).count
@note_counts = Note.where(commit_id: @commits.map(&:id))
.group(:commit_id).count
render json: { html: view_to_html_string('projects/merge_requests/show/_commits') }
end
......@@ -192,9 +192,9 @@ def resolve_conflicts
end
begin
MergeRequests::Conflicts::ResolveService.
new(merge_request).
execute(current_user, params)
MergeRequests::Conflicts::ResolveService
.new(merge_request)
.execute(current_user, params)
flash[:notice] = 'All merge conflicts were resolved. The merge request can now be merged.'
......@@ -562,8 +562,8 @@ def define_new_vars
@commits = @merge_request.compare_commits.reverse
@commit = @merge_request.diff_head_commit
@note_counts = Note.where(commit_id: @commits.map(&:id)).
group(:commit_id).count
@note_counts = Note.where(commit_id: @commits.map(&:id))
.group(:commit_id).count
@labels = LabelsFinder.new(current_user, project_id: @project.id).execute
......
......@@ -14,8 +14,8 @@ def show
def define_runners_variables
@project_runners = @project.runners.ordered
@assignable_runners = current_user.ci_authorized_runners.
assignable_for(project).ordered.page(params[:page]).per(20)
@assignable_runners = current_user.ci_authorized_runners
.assignable_for(project).ordered.page(params[:page]).per(20)
@shared_runners = Ci::Runner.shared.active
@shared_runners_count = @shared_runners.count(:all)
end
......
......@@ -29,8 +29,8 @@ def show
end
def create
result = Tags::CreateService.new(@project, current_user).
execute(params[:tag_name], params[:ref], params[:message], params[:release_description])
result = Tags::CreateService.new(@project, current_user)
.execute(params[:tag_name], params[:ref], params[:message], params[:release_description])
if result[:status] == :success
@tag = result[:tag]
......
......@@ -128,8 +128,8 @@ def valid_otp_attempt?(user)
end
def log_audit_event(user, options = {})
AuditEventService.new(user, user, options).
for_authentication.security_event
AuditEventService.new(user, user, options)
.for_authentication.security_event
end
def log_user_activity(user)
......
......@@ -4,8 +4,8 @@ class ApplicationController < ::ApplicationController
def find_transaction
if params[:transaction_id]
@transaction = Gitlab::Sherlock.collection.
find_transaction(params[:transaction_id])
@transaction = Gitlab::Sherlock.collection
.find_transaction(params[:transaction_id])
end
end
end
......
......@@ -106,11 +106,11 @@ def contributions_calendar
def load_events
# Get user activity feed for projects common for both users
@events = user.recent_events.
merge(projects_for_current_user).
references(:project).
with_associations.
limit_recent(20, params[:offset])
@events = user.recent_events
.merge(projects_for_current_user)
.references(:project)
.with_associations
.limit_recent(20, params[:offset])
end
def load_projects
......
......@@ -33,8 +33,8 @@ def execute
private
def by_current_user_access(events)
events.merge(ProjectsFinder.new(current_user: current_user).execute).
joins(:project)
events.merge(ProjectsFinder.new(current_user: current_user).execute)
.joins(:project)
end
def by_action(events)
......
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