Skip to content

Commit d6f1969

Browse files
committed
fix validation for company affiliation and email must be set for leads
1 parent 3a684dc commit d6f1969

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

generator/app.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,16 +461,11 @@ func (c *Context) Validate() []error {
461461
if val, ok := people[person.GitHub]; ok {
462462
// non-emeritus must have email and company set
463463
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 {
464+
// email and company must match across groups
465+
if val.Email != person.Email {
468466
errors = append(errors, fmt.Errorf("%s: %s email: %q does not match other entries %q", group.Dir, val.GitHub, val.Email, person.Email))
469467
}
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 {
468+
if val.Company != person.Company {
474469
errors = append(errors, fmt.Errorf("%s: %s company: %q does not match other entries %q", group.Dir, val.GitHub, val.Company, person.Company))
475470
}
476471
}
@@ -480,6 +475,13 @@ func (c *Context) Validate() []error {
480475
}
481476
} else if prefix != "emeritus_lead" {
482477
people[person.GitHub] = person
478+
// email and company must be set for leads
479+
if person.Email == "" {
480+
errors = append(errors, fmt.Errorf("%s: %s: email is empty but should be set", group.Dir, person.GitHub))
481+
}
482+
if person.Company == "" {
483+
errors = append(errors, fmt.Errorf("%s: %s: company is empty but should be set", group.Dir, person.GitHub))
484+
}
483485
}
484486

485487
if prefix == "emeritus_lead" && person.Company != "" {

0 commit comments

Comments
 (0)