Class: CodeTeams::Plugins::Identity

Inherits:
CodeTeams::Plugin show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/code_teams/plugins/identity.rb

Defined Under Namespace

Classes: IdentityStruct

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CodeTeams::Plugin

all_plugins, bust_caches!, clear_team_registry!, for, inherited, #initialize, missing_key_error_message

Constructor Details

This class inherits a constructor from CodeTeams::Plugin

Class Method Details

.validation_errors(teams) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/code_teams/plugins/identity.rb', line 19

def self.validation_errors(teams)
  errors = T.let([], T::Array[String])

  uniq_set = Set.new
  teams.each do |team|
    for_team = self.for(team)

    if !uniq_set.add?(for_team.identity.name)
      errors << "More than 1 definition for #{for_team.identity.name} found"
    end

    errors << missing_key_error_message(team, 'name') if for_team.identity.name.nil?
  end

  errors
end

Instance Method Details

#identityObject



12
13
14
15
16
# File 'lib/code_teams/plugins/identity.rb', line 12

def identity
  IdentityStruct.new(
    @team.raw_hash['name']
  )
end