diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-08-27 18:31:01 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-11 18:32:00 +0300 |
commit | 2039c8280db1646845c33d6c5a74e5f23ca6f4de (patch) | |
tree | e2b3cd3012d9711cda7c6afb962ae4228d59521a /app/finders/groups_finder.rb | |
parent | 91c40973dc620430b173ea2df968587d2a708dff (diff) |
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/finders/groups_finder.rb')
-rw-r--r-- | app/finders/groups_finder.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/finders/groups_finder.rb b/app/finders/groups_finder.rb index 0eeba1d2428..436abb332ff 100644 --- a/app/finders/groups_finder.rb +++ b/app/finders/groups_finder.rb @@ -38,6 +38,7 @@ class GroupsFinder < UnionFinder attr_reader :current_user, :params + # rubocop: disable CodeReuse/ActiveRecord def all_groups return [owned_groups] if params[:owned] return [groups_with_min_access_level] if min_access_level? @@ -49,6 +50,7 @@ class GroupsFinder < UnionFinder groups << Group.none if groups.empty? groups end + # rubocop: enable CodeReuse/ActiveRecord def groups_for_ancestors current_user.authorized_groups @@ -58,6 +60,7 @@ class GroupsFinder < UnionFinder current_user.groups end + # rubocop: disable CodeReuse/ActiveRecord def groups_with_min_access_level groups = current_user .groups @@ -67,16 +70,21 @@ class GroupsFinder < UnionFinder .new(groups) .base_and_descendants end + # rubocop: enable CodeReuse/ActiveRecord + # rubocop: disable CodeReuse/ActiveRecord def by_parent(groups) return groups unless params[:parent] groups.where(parent: params[:parent]) end + # rubocop: enable CodeReuse/ActiveRecord + # rubocop: disable CodeReuse/ActiveRecord def owned_groups current_user&.owned_groups || Group.none end + # rubocop: enable CodeReuse/ActiveRecord def include_public_groups? current_user.nil? || all_available? |