fix validation for company affiliation and email must be set for leads

This commit is contained in:
Benjamin Elder 2025-04-10 17:38:00 -07:00
parent 3a684dc269
commit d6f1969307
1 changed files with 10 additions and 8 deletions

View File

@ -461,16 +461,11 @@ func (c *Context) Validate() []error {
if val, ok := people[person.GitHub]; ok {
// non-emeritus must have email and company set
if prefix != "emeritus_lead" {
// email must be set and consistent
if val.Email == "" {
errors = append(errors, fmt.Errorf("%s: %s: email is empty but should be set", group.Dir, val.GitHub))
} else if val.Email != person.Email {
// email and company must match across groups
if val.Email != person.Email {
errors = append(errors, fmt.Errorf("%s: %s email: %q does not match other entries %q", group.Dir, val.GitHub, val.Email, person.Email))
}
// company must be set and consistent
if val.Company == "" {
errors = append(errors, fmt.Errorf("%s: %s: company is empty but should be set", group.Dir, val.Company))
} else if val.Company != person.Company {
if val.Company != person.Company {
errors = append(errors, fmt.Errorf("%s: %s company: %q does not match other entries %q", group.Dir, val.GitHub, val.Company, person.Company))
}
}
@ -480,6 +475,13 @@ func (c *Context) Validate() []error {
}
} else if prefix != "emeritus_lead" {
people[person.GitHub] = person
// email and company must be set for leads
if person.Email == "" {
errors = append(errors, fmt.Errorf("%s: %s: email is empty but should be set", group.Dir, person.GitHub))
}
if person.Company == "" {
errors = append(errors, fmt.Errorf("%s: %s: company is empty but should be set", group.Dir, person.GitHub))
}
}
if prefix == "emeritus_lead" && person.Company != "" {