12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/code_ownership/private/validations/files_have_owners.rb', line 12
def validation_errors(files:, autocorrect: true, stage_changes: true)
cache = Private.glob_cache
file_mappings = cache.mapper_descriptions_that_map_files(files)
files_not_mapped_at_all = file_mappings.select do |_file, mapper_descriptions|
mapper_descriptions.count.zero?
end
errors = T.let([], T::Array[String])
if files_not_mapped_at_all.any?
errors << <<~MSG
Some files are missing ownership:
#{files_not_mapped_at_all.map { |file, _mappers| "- #{file}" }.join("\n")}
MSG
end
errors
end
|