summaryrefslogtreecommitdiff
path: root/app/finders/events_finder.rb
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/finders/events_finder.rb
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/finders/events_finder.rb')
-rw-r--r--app/finders/events_finder.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/finders/events_finder.rb b/app/finders/events_finder.rb
index 8676925a540..a8d4f56a84c 100644
--- a/app/finders/events_finder.rb
+++ b/app/finders/events_finder.rb
@@ -36,32 +36,42 @@ class EventsFinder
private
+ # rubocop: disable CodeReuse/ActiveRecord
def by_current_user_access(events)
- events.merge(ProjectsFinder.new(current_user: current_user).execute)
+ events.merge(ProjectsFinder.new(current_user: current_user).execute) # rubocop: disable CodeReuse/Finder
.joins(:project)
end
+ # rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
def by_action(events)
return events unless Event::ACTIONS[params[:action]]
events.where(action: Event::ACTIONS[params[:action]])
end
+ # rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
def by_target_type(events)
return events unless Event::TARGET_TYPES[params[:target_type]]
events.where(target_type: Event::TARGET_TYPES[params[:target_type]])
end
+ # rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
def by_created_at_before(events)
return events unless params[:before]
events.where('events.created_at < ?', params[:before].beginning_of_day)
end
+ # rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
def by_created_at_after(events)
return events unless params[:after]
events.where('events.created_at > ?', params[:after].end_of_day)
end
+ # rubocop: enable CodeReuse/ActiveRecord
end