Sha256: 427effbcc4ec118ef19cf04754e3beb3a05eb8d39c7de4edb31aeca9f0f77d3c
Contents?: true
Size: 1.26 KB
Versions: 9
Compression:
Stored size: 1.26 KB
Contents
# typed: true module CodeOwnership module Private module TeamPlugins class Github < CodeTeams::Plugin extend T::Sig extend T::Helpers GithubStruct = Struct.new(:team, :do_not_add_to_codeowners_file) sig { returns(GithubStruct) } def github raw_github = @team.raw_hash['github'] || {} GithubStruct.new( raw_github['team'], raw_github['do_not_add_to_codeowners_file'] || false ) end sig { override.params(teams: T::Array[CodeTeams::Team]).returns(T::Array[String]) } def self.validation_errors(teams) all_github_teams = teams.flat_map { |team| self.for(team).github.team } teams_used_more_than_once = all_github_teams.tally.select do |_team, count| count > 1 end errors = T.let([], T::Array[String]) if teams_used_more_than_once.any? errors << <<~ERROR The following teams are specified multiple times: Each code team must have a unique GitHub team in order to write the CODEOWNERS file correctly. #{teams_used_more_than_once.keys.join("\n")} ERROR end errors end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems