@@ -438,6 +438,11 @@ func (c *Context) Sort() {
438
438
// Validate returns a list of errors encountered while validating a Context
439
439
func (c * Context ) Validate () []error {
440
440
errors := []error {}
441
+ // github to Person info
442
+ // TODO: this would probably be a better config format? to avoid duplicating
443
+ // people with potentially differing info, versus referring to leads by
444
+ // github handle within each SIG and then keeping this map alongside the SIGs
445
+ // This could break external tooling parsing the file though.
441
446
people := make (map [string ]Person )
442
447
reRawGitHubURL := regexp .MustCompile (regexRawGitHubURL )
443
448
reGitHubURL := regexp .MustCompile (regexGitHubURL )
@@ -454,8 +459,24 @@ func (c *Context) Validate() []error {
454
459
for prefix , persons := range group .Leadership .PrefixToPersonMap () {
455
460
for _ , person := range persons {
456
461
if val , ok := people [person .GitHub ]; ok {
457
- if val .Name != person .Name || (prefix != "emeritus_lead" && val .Company != person .Company ) {
458
- errors = append (errors , fmt .Errorf ("%s: %ss: expected person: %v, got: %v" , group .Dir , prefix , val , person ))
462
+ // non-emeritus must have email and company set
463
+ if prefix != "emeritus_lead" {
464
+ // email must be set and consistent
465
+ if val .Email == "" {
466
+ errors = append (errors , fmt .Errorf ("%s: %s: email is empty but should be set" , group .Dir , val .GitHub ))
467
+ } else if val .Email != person .Email {
468
+ errors = append (errors , fmt .Errorf ("%s: %s email: %q does not match other entries %q" , group .Dir , val .GitHub , val .Email , person .Email ))
469
+ }
470
+ // company must be set and consistent
471
+ if val .Company == "" {
472
+ errors = append (errors , fmt .Errorf ("%s: %s: company is empty but should be set" , group .Dir , val .Company ))
473
+ } else if val .Company != person .Company {
474
+ errors = append (errors , fmt .Errorf ("%s: %s company: %q does not match other entries %q" , group .Dir , val .GitHub , val .Company , person .Company ))
475
+ }
476
+ }
477
+ // all entries should have github + name, emeritus or not
478
+ if val .Name != person .Name {
479
+ errors = append (errors , fmt .Errorf ("%s: %s: expected person: %v, got: %v" , group .Dir , prefix , val , person ))
459
480
}
460
481
} else if prefix != "emeritus_lead" {
461
482
people [person .GitHub ] = person
0 commit comments