Skip to content

Commit c731a5c

Browse files
committed
fix: remove employer field entirely
1 parent 4564068 commit c731a5c

File tree

1 file changed

+5
-46
lines changed

1 file changed

+5
-46
lines changed

cmd/readmevalidation/contributors.go

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ type contributorProfileFrontmatter struct {
2121
GithubUsername string `yaml:"github"`
2222
// Script assumes that if value is nil, the Registry site build step will
2323
// backfill the value with the user's GitHub avatar URL
24-
AvatarURL *string `yaml:"avatar"`
25-
LinkedinURL *string `yaml:"linkedin"`
26-
WebsiteURL *string `yaml:"website"`
27-
SupportEmail *string `yaml:"support_email"`
28-
EmployerGithubUsername *string `yaml:"employer_github"`
29-
ContributorStatus *string `yaml:"status"`
24+
AvatarURL *string `yaml:"avatar"`
25+
LinkedinURL *string `yaml:"linkedin"`
26+
WebsiteURL *string `yaml:"website"`
27+
SupportEmail *string `yaml:"support_email"`
28+
ContributorStatus *string `yaml:"status"`
3029
}
3130

3231
type contributorProfile struct {
@@ -47,29 +46,6 @@ func validateContributorGithubUsername(githubUsername string) error {
4746
return nil
4847
}
4948

50-
func validateContributorEmployerGithubUsername(employerGithubUsername *string, githubUsername string) []error {
51-
if employerGithubUsername == nil {
52-
return nil
53-
}
54-
55-
errs := []error{}
56-
if *employerGithubUsername == "" {
57-
errs = append(errs, errors.New("company_github field is defined but has empty value"))
58-
return errs
59-
}
60-
61-
lower := strings.ToLower(*employerGithubUsername)
62-
if uriSafe := url.PathEscape(lower); uriSafe != lower {
63-
errs = append(errs, fmt.Errorf("gitHub company username %q is not a valid URL path segment", *employerGithubUsername))
64-
}
65-
66-
if *employerGithubUsername == githubUsername {
67-
errs = append(errs, fmt.Errorf("cannot list own GitHub name (%q) as employer", githubUsername))
68-
}
69-
70-
return errs
71-
}
72-
7349
func validateContributorDisplayName(displayName string) error {
7450
if displayName == "" {
7551
return fmt.Errorf("missing display_name")
@@ -211,9 +187,6 @@ func validateContributorYaml(yml contributorProfile) []error {
211187
allErrs = append(allErrs, addFilePathToError(yml.filePath, err))
212188
}
213189

214-
for _, err := range validateContributorEmployerGithubUsername(yml.frontmatter.EmployerGithubUsername, yml.frontmatter.GithubUsername) {
215-
allErrs = append(allErrs, addFilePathToError(yml.filePath, err))
216-
}
217190
for _, err := range validateContributorSupportEmail(yml.frontmatter.SupportEmail) {
218191
allErrs = append(allErrs, addFilePathToError(yml.filePath, err))
219192
}
@@ -264,27 +237,13 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil
264237
}
265238
}
266239

267-
employeeGithubGroups := map[string][]string{}
268240
yamlValidationErrors := []error{}
269241
for _, p := range profilesByUsername {
270242
errors := validateContributorYaml(p)
271243
if len(errors) > 0 {
272244
yamlValidationErrors = append(yamlValidationErrors, errors...)
273245
continue
274246
}
275-
276-
if p.frontmatter.EmployerGithubUsername != nil {
277-
employeeGithubGroups[*p.frontmatter.EmployerGithubUsername] = append(
278-
employeeGithubGroups[*p.frontmatter.EmployerGithubUsername],
279-
p.frontmatter.GithubUsername,
280-
)
281-
}
282-
}
283-
for companyName, group := range employeeGithubGroups {
284-
if _, found := profilesByUsername[companyName]; found {
285-
continue
286-
}
287-
yamlValidationErrors = append(yamlValidationErrors, fmt.Errorf("%q: company %q does not exist but is referenced by these profiles: [%s]", rootRegistryPath, companyName, strings.Join(group, ", ")))
288247
}
289248
if len(yamlValidationErrors) != 0 {
290249
return nil, validationPhaseError{

0 commit comments

Comments
 (0)