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/groups | |
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/groups')
-rw-r--r-- | app/services/groups/destroy_service.rb | 2 | ||||
-rw-r--r-- | app/services/groups/transfer_service.rb | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/app/services/groups/destroy_service.rb b/app/services/groups/destroy_service.rb index 93d84bd8a9c..641111aeadc 100644 --- a/app/services/groups/destroy_service.rb +++ b/app/services/groups/destroy_service.rb @@ -9,6 +9,7 @@ module Groups Rails.logger.info("User #{current_user.id} scheduled a deletion of group ID #{group.id} with job ID #{job_id}") end + # rubocop: disable CodeReuse/ActiveRecord def execute group.prepare_for_destroy @@ -30,5 +31,6 @@ module Groups group.destroy end + # rubocop: enable CodeReuse/ActiveRecord end end diff --git a/app/services/groups/transfer_service.rb b/app/services/groups/transfer_service.rb index ea7576077f3..5efa746dfb9 100644 --- a/app/services/groups/transfer_service.rb +++ b/app/services/groups/transfer_service.rb @@ -64,9 +64,11 @@ module Groups end end + # rubocop: disable CodeReuse/ActiveRecord def namespace_with_same_path? Namespace.exists?(path: @group.path, parent: @new_parent_group) end + # rubocop: enable CodeReuse/ActiveRecord def update_group_attributes if @new_parent_group && @new_parent_group.visibility_level < @group.visibility_level @@ -78,6 +80,7 @@ module Groups @group.save! end + # rubocop: disable CodeReuse/ActiveRecord def update_children_and_projects_visibility descendants = @group.descendants.where("visibility_level > ?", @new_parent_group.visibility_level) @@ -90,6 +93,7 @@ module Groups .where("visibility_level > ?", @new_parent_group.visibility_level) .update_all(visibility_level: @new_parent_group.visibility_level) end + # rubocop: enable CodeReuse/ActiveRecord def raise_transfer_error(message) raise TransferError, ERROR_MESSAGES[message] |