Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2018-08-27 18:31:01 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2018-09-11 18:32:00 +0300
commit2039c8280db1646845c33d6c5a74e5f23ca6f4de (patch)
treee2b3cd3012d9711cda7c6afb962ae4228d59521a /app/workers/repository_check/batch_worker.rb
parent91c40973dc620430b173ea2df968587d2a708dff (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/workers/repository_check/batch_worker.rb')
-rw-r--r--app/workers/repository_check/batch_worker.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/workers/repository_check/batch_worker.rb b/app/workers/repository_check/batch_worker.rb
index 07559ea479b..c1bb1adc9cc 100644
--- a/app/workers/repository_check/batch_worker.rb
+++ b/app/workers/repository_check/batch_worker.rb
@@ -59,22 +59,28 @@ module RepositoryCheck
never_checked_project_ids(BATCH_SIZE) + old_checked_project_ids(BATCH_SIZE)
end
+ # rubocop: disable CodeReuse/ActiveRecord
def never_checked_project_ids(batch_size)
projects_on_shard.where(last_repository_check_at: nil)
.where('created_at < ?', 24.hours.ago)
.limit(batch_size).pluck(:id)
end
+ # rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
def old_checked_project_ids(batch_size)
projects_on_shard.where.not(last_repository_check_at: nil)
.where('last_repository_check_at < ?', 1.month.ago)
.reorder(last_repository_check_at: :asc)
.limit(batch_size).pluck(:id)
end
+ # rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
def projects_on_shard
Project.where(repository_storage: shard_name)
end
+ # rubocop: enable CodeReuse/ActiveRecord
def try_obtain_lease_for_project(id)
# Use a 24-hour timeout because on servers/projects where 'git fsck' is