diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-08-27 17:31:01 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-11 17:32:00 +0200 |
commit | 2039c8280db1646845c33d6c5a74e5f23ca6f4de (patch) | |
tree | e2b3cd3012d9711cda7c6afb962ae4228d59521a /app/services/issues | |
parent | 91c40973dc620430b173ea2df968587d2a708dff (diff) | |
download | gitlab-ce-2039c8280db1646845c33d6c5a74e5f23ca6f4de.tar.gz |
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
Diffstat (limited to 'app/services/issues')
-rw-r--r-- | app/services/issues/base_service.rb | 2 | ||||
-rw-r--r-- | app/services/issues/move_service.rb | 4 | ||||
-rw-r--r-- | app/services/issues/referenced_merge_requests_service.rb | 6 | ||||
-rw-r--r-- | app/services/issues/update_service.rb | 4 |
4 files changed, 16 insertions, 0 deletions
diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb index 25389a946bb..ef08adf4f92 100644 --- a/app/services/issues/base_service.rb +++ b/app/services/issues/base_service.rb @@ -31,6 +31,7 @@ module Issues issue.project.execute_services(issue_data, hooks_scope) end + # rubocop: disable CodeReuse/ActiveRecord def filter_assignee(issuable) return if params[:assignee_ids].blank? @@ -48,6 +49,7 @@ module Issues params.delete(:assignee_ids) end end + # rubocop: enable CodeReuse/ActiveRecord def update_project_counter_caches?(issue) super || issue.confidential_changed? diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb index ec9d8944e4e..d2bdba1e627 100644 --- a/app/services/issues/move_service.rb +++ b/app/services/issues/move_service.rb @@ -58,6 +58,7 @@ module Issues CreateService.new(@new_project, @current_user, new_params).execute end + # rubocop: disable CodeReuse/ActiveRecord def cloneable_label_ids params = { project_id: @new_project.id, @@ -67,6 +68,7 @@ module Issues LabelsFinder.new(current_user, params).execute.pluck(:id) end + # rubocop: enable CodeReuse/ActiveRecord def cloneable_milestone_id title = @old_issue.milestone&.title @@ -97,6 +99,7 @@ module Issues end end + # rubocop: disable CodeReuse/ActiveRecord def copy_resource_label_events @old_issue.resource_label_events.find_in_batches do |batch| events = batch.map do |event| @@ -108,6 +111,7 @@ module Issues Gitlab::Database.bulk_insert(ResourceLabelEvent.table_name, events) end end + # rubocop: enable CodeReuse/ActiveRecord def rewrite_issue_award_emoji rewrite_award_emoji(@old_issue, @new_issue) diff --git a/app/services/issues/referenced_merge_requests_service.rb b/app/services/issues/referenced_merge_requests_service.rb index 40d78502697..a69cd324b1e 100644 --- a/app/services/issues/referenced_merge_requests_service.rb +++ b/app/services/issues/referenced_merge_requests_service.rb @@ -2,6 +2,7 @@ module Issues class ReferencedMergeRequestsService < Issues::BaseService + # rubocop: disable CodeReuse/ActiveRecord def execute(issue) referenced = referenced_merge_requests(issue) closed_by = closed_by_merge_requests(issue) @@ -12,6 +13,7 @@ module Issues [sort_by_iid(referenced), sort_by_iid(closed_by)] end + # rubocop: enable CodeReuse/ActiveRecord def referenced_merge_requests(issue) merge_requests = extract_merge_requests(issue) @@ -29,6 +31,7 @@ module Issues ) end + # rubocop: disable CodeReuse/ActiveRecord def closed_by_merge_requests(issue) return [] unless issue.open? @@ -39,6 +42,7 @@ module Issues ids = MergeRequestsClosingIssues.where(merge_request_id: merge_requests.map(&:id), issue_id: issue.id).pluck(:merge_request_id) merge_requests.select { |mr| mr.id.in?(ids) } end + # rubocop: enable CodeReuse/ActiveRecord private @@ -54,10 +58,12 @@ module Issues ext.merge_requests end + # rubocop: disable CodeReuse/ActiveRecord def issue_notes(issue) @issue_notes ||= {} @issue_notes[issue] ||= issue.notes.includes(:author) end + # rubocop: enable CodeReuse/ActiveRecord def sort_by_iid(merge_requests) Gitlab::IssuableSorter.sort(project, merge_requests) { |mr| mr.iid.to_s } diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index faa4c8a5a4f..b54b0bf6ef6 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -67,6 +67,7 @@ module Issues issue.move_between(issue_before, issue_after) end + # rubocop: disable CodeReuse/ActiveRecord def change_issue_duplicate(issue) canonical_issue_id = params.delete(:canonical_issue_id) canonical_issue = IssuesFinder.new(current_user).find_by(id: canonical_issue_id) @@ -75,6 +76,7 @@ module Issues Issues::DuplicateService.new(project, current_user).execute(issue, canonical_issue) end end + # rubocop: enable CodeReuse/ActiveRecord def move_issue_to_new_project(issue) target_project = params.delete(:target_project) @@ -89,6 +91,7 @@ module Issues private + # rubocop: disable CodeReuse/ActiveRecord def get_issue_if_allowed(id, board_group_id = nil) return unless id @@ -101,6 +104,7 @@ module Issues issue if can?(current_user, :update_issue, issue) end + # rubocop: enable CodeReuse/ActiveRecord def create_confidentiality_note(issue) SystemNoteService.change_issue_confidentiality(issue, issue.project, current_user) |