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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /tooling/lib
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'tooling/lib')
-rw-r--r--tooling/lib/tooling/find_codeowners.rb92
-rw-r--r--tooling/lib/tooling/helm3_client.rb4
-rw-r--r--tooling/lib/tooling/test_map_packer.rb2
3 files changed, 62 insertions, 36 deletions
diff --git a/tooling/lib/tooling/find_codeowners.rb b/tooling/lib/tooling/find_codeowners.rb
index 3b50b33d85c..6a90f86eecc 100644
--- a/tooling/lib/tooling/find_codeowners.rb
+++ b/tooling/lib/tooling/find_codeowners.rb
@@ -9,37 +9,10 @@ module Tooling
puts section
group_defintions.each do |group, list|
- matched_files = git_ls_files.each_line.select do |line|
- list[:allow].find do |pattern|
- path = "/#{line.chomp}"
+ print_entries(group, list[:entries]) if list[:entries]
+ print_expanded_entries(group, list) if list[:allow]
- path_matches?(pattern, path) &&
- list[:deny].none? { |pattern| path_matches?(pattern, path) }
- end
- end
-
- consolidated = consolidate_paths(matched_files)
- consolidated_again = consolidate_paths(consolidated)
-
- # Consider the directory structure is a tree structure:
- # https://en.wikipedia.org/wiki/Tree_(data_structure)
- # After we consolidated the leaf entries, it could be possible that
- # we can consolidate further for the new leaves. Repeat this
- # process until we see no improvements.
- while consolidated_again.size < consolidated.size
- consolidated = consolidated_again
- consolidated_again = consolidate_paths(consolidated)
- end
-
- consolidated.each do |line|
- path = line.chomp
-
- if File.directory?(path)
- puts "/#{path}/ #{group}"
- else
- puts "/#{path} #{group}"
- end
- end
+ puts
end
end
end
@@ -50,10 +23,20 @@ module Tooling
result.each do |section, group_defintions|
group_defintions.each do |group, definitions|
definitions.transform_values! do |rules|
- rules[:keywords].flat_map do |keyword|
- rules[:patterns].map do |pattern|
- pattern % { keyword: keyword }
+ case rules
+ when Hash
+ case rules[:keywords]
+ when Array
+ rules[:keywords].flat_map do |keyword|
+ rules[:patterns].map do |pattern|
+ pattern % { keyword: keyword }
+ end
+ end
+ else
+ rules[:patterns]
end
+ when Array
+ rules
end
end
end
@@ -118,6 +101,49 @@ module Tooling
private
+ def print_entries(group, entries)
+ entries.each do |entry|
+ puts "#{entry} #{group}"
+ end
+ end
+
+ def print_expanded_entries(group, list)
+ matched_files = git_ls_files.each_line.select do |line|
+ list[:allow].find do |pattern|
+ path = "/#{line.chomp}"
+
+ path_matches?(pattern, path) &&
+ (
+ list[:deny].nil? ||
+ list[:deny].none? { |pattern| path_matches?(pattern, path) }
+ )
+ end
+ end
+
+ consolidated = consolidate_paths(matched_files)
+ consolidated_again = consolidate_paths(consolidated)
+
+ # Consider the directory structure is a tree structure:
+ # https://en.wikipedia.org/wiki/Tree_(data_structure)
+ # After we consolidated the leaf entries, it could be possible that
+ # we can consolidate further for the new leaves. Repeat this
+ # process until we see no improvements.
+ while consolidated_again.size < consolidated.size
+ consolidated = consolidated_again
+ consolidated_again = consolidate_paths(consolidated)
+ end
+
+ consolidated.each do |line|
+ path = line.chomp
+
+ if File.directory?(path)
+ puts "/#{path}/ #{group}"
+ else
+ puts "/#{path} #{group}"
+ end
+ end
+ end
+
def find_dir_maxdepth_1(dir)
`find #{dir} -maxdepth 1`
end
diff --git a/tooling/lib/tooling/helm3_client.rb b/tooling/lib/tooling/helm3_client.rb
index 6e4a35e82f1..82ebe3f51dc 100644
--- a/tooling/lib/tooling/helm3_client.rb
+++ b/tooling/lib/tooling/helm3_client.rb
@@ -84,7 +84,7 @@ module Tooling
# method - The Octokit method to use for getting the data.
# args - Arguments to pass to the `helm list` command.
def each_releases_page(args, &block)
- return to_enum(__method__, args) unless block_given?
+ return to_enum(__method__, args) unless block
page = 0
final_args = args.dup
@@ -100,7 +100,7 @@ module Tooling
#
# args - Any arguments to pass to the `helm list` command.
def each_release(args, &block)
- return to_enum(__method__, args) unless block_given?
+ return to_enum(__method__, args) unless block
each_releases_page(args) do |page|
page.releases.each do |release|
diff --git a/tooling/lib/tooling/test_map_packer.rb b/tooling/lib/tooling/test_map_packer.rb
index d74edb9500f..151ce88111f 100644
--- a/tooling/lib/tooling/test_map_packer.rb
+++ b/tooling/lib/tooling/test_map_packer.rb
@@ -44,7 +44,7 @@ module Tooling
end
def traverse(tree, segments = [], &block)
- return to_enum(__method__, tree, segments) unless block_given?
+ return to_enum(__method__, tree, segments) unless block
if tree == MARKER
return yield segments.join(SEPARATOR)