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:
Diffstat (limited to 'lib/tasks/gitlab/tw/codeowners.rake')
-rw-r--r--lib/tasks/gitlab/tw/codeowners.rake21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/tasks/gitlab/tw/codeowners.rake b/lib/tasks/gitlab/tw/codeowners.rake
index 7a2dee3e2e4..ec2ea623e02 100644
--- a/lib/tasks/gitlab/tw/codeowners.rake
+++ b/lib/tasks/gitlab/tw/codeowners.rake
@@ -81,6 +81,10 @@ namespace :tw do
CodeOwnerRule.new('Workspace', '@lciutacu')
].freeze
+ ERRORS_EXCLUDED_FILES = [
+ '/doc/architecture'
+ ].freeze
+
CODEOWNERS_BLOCK_BEGIN = "# Begin rake-managed-docs-block"
CODEOWNERS_BLOCK_END = "# End rake-managed-docs-block"
@@ -105,16 +109,17 @@ namespace :tw do
Dir.glob(path) do |file|
yaml_data = YAML.load_file(file)
document = Document.new(yaml_data['group'], yaml_data['redirect_to'])
+ relative_file = file.delete_prefix(Dir.pwd)
if document.missing_metadata?
- errors << file
+ errors << relative_file unless ERRORS_EXCLUDED_FILES.any? { |element| relative_file.starts_with?(element) }
next
end
writer = writer_for_group(document.group)
next unless writer
- mappings << DocumentOwnerMapping.new(file.delete_prefix(Dir.pwd), writer) if document.has_a_valid_group?
+ mappings << DocumentOwnerMapping.new(relative_file, writer) if document.has_a_valid_group?
end
deduplicated_mappings = Set.new
@@ -139,10 +144,16 @@ namespace :tw do
File.write(codeowners_path, new_codeowners_content)
+ if current_codeowners_content == new_codeowners_content
+ puts "~ CODEOWNERS already up to date".color(:yellow)
+ else
+ puts "✓ CODEOWNERS updated".color(:green)
+ end
+
if errors.present?
- puts "-----"
- puts "ERRORS - the following files are missing the correct metadata:"
- errors.map { |file| puts file.gsub(Dir.pwd, ".") }
+ puts ""
+ puts "✘ Files with missing metadata found:".color(:red)
+ errors.map { |file| puts file }
end
end
end