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/workers/repository_check | |
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/workers/repository_check')
-rw-r--r-- | app/workers/repository_check/batch_worker.rb | 6 | ||||
-rw-r--r-- | app/workers/repository_check/clear_worker.rb | 2 | ||||
-rw-r--r-- | app/workers/repository_check/single_repository_worker.rb | 2 |
3 files changed, 10 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 diff --git a/app/workers/repository_check/clear_worker.rb b/app/workers/repository_check/clear_worker.rb index 81e1a4b63bb..01964c69fb2 100644 --- a/app/workers/repository_check/clear_worker.rb +++ b/app/workers/repository_check/clear_worker.rb @@ -5,6 +5,7 @@ module RepositoryCheck include ApplicationWorker include RepositoryCheckQueue + # rubocop: disable CodeReuse/ActiveRecord def perform # Do small batched updates because these updates will be slow and locking Project.select(:id).find_in_batches(batch_size: 100) do |batch| @@ -14,5 +15,6 @@ module RepositoryCheck ) end end + # rubocop: enable CodeReuse/ActiveRecord end end diff --git a/app/workers/repository_check/single_repository_worker.rb b/app/workers/repository_check/single_repository_worker.rb index f44e5693b25..a8097af321f 100644 --- a/app/workers/repository_check/single_repository_worker.rb +++ b/app/workers/repository_check/single_repository_worker.rb @@ -48,9 +48,11 @@ module RepositoryCheck false end + # rubocop: disable CodeReuse/ActiveRecord def has_changes?(project) Project.with_push.exists?(project.id) end + # rubocop: enable CodeReuse/ActiveRecord def has_wiki_changes?(project) return false unless project.wiki_enabled? |