summaryrefslogtreecommitdiff
path: root/app/models/hooks
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2018-08-27 17:31:01 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2018-09-11 17:32:00 +0200
commit2039c8280db1646845c33d6c5a74e5f23ca6f4de (patch)
treee2b3cd3012d9711cda7c6afb962ae4228d59521a /app/models/hooks
parent91c40973dc620430b173ea2df968587d2a708dff (diff)
downloadgitlab-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/models/hooks')
-rw-r--r--app/models/hooks/service_hook.rb2
-rw-r--r--app/models/hooks/web_hook.rb4
2 files changed, 6 insertions, 0 deletions
diff --git a/app/models/hooks/service_hook.rb b/app/models/hooks/service_hook.rb
index bda82a116a1..7d9f6d89d44 100644
--- a/app/models/hooks/service_hook.rb
+++ b/app/models/hooks/service_hook.rb
@@ -4,7 +4,9 @@ class ServiceHook < WebHook
belongs_to :service
validates :service, presence: true
+ # rubocop: disable CodeReuse/ServiceClass
def execute(data)
WebHookService.new(self, data, 'service_hook').execute
end
+ # rubocop: enable CodeReuse/ServiceClass
end
diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb
index 20f15c15277..771a61b090f 100644
--- a/app/models/hooks/web_hook.rb
+++ b/app/models/hooks/web_hook.rb
@@ -11,13 +11,17 @@ class WebHook < ActiveRecord::Base
validates :token, format: { without: /\n/ }
validates :push_events_branch_filter, branch_filter: true
+ # rubocop: disable CodeReuse/ServiceClass
def execute(data, hook_name)
WebHookService.new(self, data, hook_name).execute
end
+ # rubocop: enable CodeReuse/ServiceClass
+ # rubocop: disable CodeReuse/ServiceClass
def async_execute(data, hook_name)
WebHookService.new(self, data, hook_name).async_execute
end
+ # rubocop: enable CodeReuse/ServiceClass
# Allow urls pointing localhost and the local network
def allow_local_requests?