From 2039c8280db1646845c33d6c5a74e5f23ca6f4de Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 27 Aug 2018 17:31:01 +0200 Subject: 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. --- app/models/key.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/models/key.rb') diff --git a/app/models/key.rb b/app/models/key.rb index 3bb0d2f6f9c..bdb83e12793 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -55,9 +55,11 @@ class Key < ActiveRecord::Base "key-#{id}" end + # rubocop: disable CodeReuse/ServiceClass def update_last_used_at Keys::LastUsedService.new(self).execute end + # rubocop: enable CodeReuse/ServiceClass def add_to_shell GitlabShellWorker.perform_async( @@ -67,9 +69,11 @@ class Key < ActiveRecord::Base ) end + # rubocop: disable CodeReuse/ServiceClass def post_create_hook SystemHooksService.new.execute_hooks_for(self, :create) end + # rubocop: enable CodeReuse/ServiceClass def remove_from_shell GitlabShellWorker.perform_async( @@ -79,15 +83,19 @@ class Key < ActiveRecord::Base ) end + # rubocop: disable CodeReuse/ServiceClass def refresh_user_cache return unless user Users::KeysCountService.new(user).refresh_cache end + # rubocop: enable CodeReuse/ServiceClass + # rubocop: disable CodeReuse/ServiceClass def post_destroy_hook SystemHooksService.new.execute_hooks_for(self, :destroy) end + # rubocop: enable CodeReuse/ServiceClass def public_key @public_key ||= Gitlab::SSHPublicKey.new(key) -- cgit v1.2.1