summaryrefslogtreecommitdiff
path: root/scripts/rubocop-max-files-in-cache-check
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 09:40:42 +0000
commitee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch)
treef8479f94a28f66654c6a4f6fb99bad6b4e86a40e /scripts/rubocop-max-files-in-cache-check
parent62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff)
downloadgitlab-ce-ee664acb356f8123f4f6b00b73c1e1cf0866c7fb.tar.gz
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'scripts/rubocop-max-files-in-cache-check')
-rwxr-xr-xscripts/rubocop-max-files-in-cache-check5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/rubocop-max-files-in-cache-check b/scripts/rubocop-max-files-in-cache-check
index 5b422d0a0f4..34caa0e197c 100755
--- a/scripts/rubocop-max-files-in-cache-check
+++ b/scripts/rubocop-max-files-in-cache-check
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
-require 'yaml'
+require_relative '../config/bundler_setup'
+require 'rubocop'
MINIMUM_MAX_FILES_IN_CACHE_MARGIN = 1.05
RECOMMENDED_MAX_FILES_IN_CACHE_MARGIN = 1.25
@@ -14,7 +15,7 @@ rubocop_target_files_count = `#{RUBOCOP_LIST_TARGET_FILES_COMMAND}`.strip.to_i
raise Error, "#{RUBOCOP_LIST_TARGET_FILES_COMMAND} failed with status #{$?}!" if rubocop_target_files_count == 0
rubocop_target_files_count = rubocop_target_files_count.to_i
-rubocop_current_max_files_in_cache = YAML.load_file(File.expand_path('../.rubocop.yml', __dir__)).dig('AllCops', 'MaxFilesInCache').to_i
+rubocop_current_max_files_in_cache = RuboCop::ConfigLoader.load_yaml_configuration(File.expand_path('../.rubocop.yml', __dir__)).dig('AllCops', 'MaxFilesInCache').to_i
minimum_max_files_in_cache = (rubocop_target_files_count * MINIMUM_MAX_FILES_IN_CACHE_MARGIN).round(-3)
# We want AllCops.MaxFilesInCache to be at least 5% above the actual files count at any time to give us enough time to increase it accordingly