diff options
author | Robert Speicher <robert@gitlab.com> | 2018-09-13 14:53:05 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-09-13 14:53:05 +0000 |
commit | c7d1eef671dbf598814a6c2ff1f81b924583ae8a (patch) | |
tree | 23988df1d29e933943858a66821ba7f493976b3e /app/models/hooks | |
parent | ff5d8b635f234241441009e41af7b61f5804b2c2 (diff) | |
parent | 2039c8280db1646845c33d6c5a74e5f23ca6f4de (diff) | |
download | gitlab-ce-c7d1eef671dbf598814a6c2ff1f81b924583ae8a.tar.gz |
Merge branch 'rubocop-code-reuse' into 'master'
Add RuboCop cops to enforce code reusing rules
See merge request gitlab-org/gitlab-ce!21391
Diffstat (limited to 'app/models/hooks')
-rw-r--r-- | app/models/hooks/service_hook.rb | 2 | ||||
-rw-r--r-- | app/models/hooks/web_hook.rb | 4 |
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? |