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/policies | |
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/policies')
-rw-r--r-- | app/policies/application_setting/term_policy.rb | 2 | ||||
-rw-r--r-- | app/policies/ci/runner_policy.rb | 2 | ||||
-rw-r--r-- | app/policies/deploy_key_policy.rb | 2 | ||||
-rw-r--r-- | app/policies/project_policy.rb | 2 |
4 files changed, 8 insertions, 0 deletions
diff --git a/app/policies/application_setting/term_policy.rb b/app/policies/application_setting/term_policy.rb index 17f00f33d35..c0d2ceaa349 100644 --- a/app/policies/application_setting/term_policy.rb +++ b/app/policies/application_setting/term_policy.rb @@ -19,6 +19,7 @@ class ApplicationSetting rule { terms_accepted }.prevent :accept_terms + # rubocop: disable CodeReuse/ActiveRecord def agreement strong_memoize(:agreement) do next nil if @user.nil? || @subject.nil? @@ -26,5 +27,6 @@ class ApplicationSetting @user.term_agreements.find_by(term: @subject) end end + # rubocop: enable CodeReuse/ActiveRecord end end diff --git a/app/policies/ci/runner_policy.rb b/app/policies/ci/runner_policy.rb index c44f22b6ad3..de76b7b2b5b 100644 --- a/app/policies/ci/runner_policy.rb +++ b/app/policies/ci/runner_policy.rb @@ -5,7 +5,9 @@ module Ci with_options scope: :subject, score: 0 condition(:locked, scope: :subject) { @subject.locked? } + # rubocop: disable CodeReuse/ActiveRecord condition(:owned_runner) { @user.ci_owned_runners.exists?(@subject.id) } + # rubocop: enable CodeReuse/ActiveRecord rule { anonymous }.prevent_all diff --git a/app/policies/deploy_key_policy.rb b/app/policies/deploy_key_policy.rb index 204c54a5b20..7f0ec011e79 100644 --- a/app/policies/deploy_key_policy.rb +++ b/app/policies/deploy_key_policy.rb @@ -4,7 +4,9 @@ class DeployKeyPolicy < BasePolicy with_options scope: :subject, score: 0 condition(:private_deploy_key) { @subject.private? } + # rubocop: disable CodeReuse/ActiveRecord condition(:has_deploy_key) { @user.project_deploy_keys.exists?(id: @subject.id) } + # rubocop: enable CodeReuse/ActiveRecord rule { anonymous }.prevent_all diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 273a93a1423..d0e84b1aa38 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -398,6 +398,7 @@ class ProjectPolicy < BasePolicy end end + # rubocop: disable CodeReuse/ActiveRecord def project_group_member? return false if @user.nil? @@ -407,6 +408,7 @@ class ProjectPolicy < BasePolicy project.group.requesters.exists?(user_id: @user.id) ) end + # rubocop: enable CodeReuse/ActiveRecord def team_access_level return -1 if @user.nil? |