@@ -33,27 +33,6 @@ type contributorProfile struct {
3333 filePath string
3434}
3535
36- var _ error = validationPhaseError {}
37-
38- type validationPhaseError struct {
39- phase string
40- errors []error
41- }
42-
43- func (vpe validationPhaseError ) Error () string {
44- validationStrs := []string {}
45- for _ , e := range vpe .errors {
46- validationStrs = append (validationStrs , fmt .Sprintf ("- %v" , e ))
47- }
48- slices .Sort (validationStrs )
49-
50- msg := fmt .Sprintf ("Error during %q phase of README validation:" , vpe .phase )
51- msg += strings .Join (validationStrs , "\n " )
52- msg += "\n "
53-
54- return msg
55- }
56-
5736func validateContributorGithubUsername (githubUsername string ) error {
5837 if githubUsername == "" {
5938 return errors .New ("missing GitHub username" )
@@ -219,7 +198,7 @@ func addFilePathToError(filePath string, err error) error {
219198 return fmt .Errorf ("%q: %v" , filePath , err )
220199}
221200
222- func validateContributorYaml (yml contributorProfile ) []error {
201+ func validateContributorProfile (yml contributorProfile ) []error {
223202 allProblems := []error {}
224203
225204 if err := validateContributorGithubUsername (yml .frontmatter .GithubUsername ); err != nil {
@@ -286,15 +265,15 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil
286265 }
287266 if len (yamlParsingErrors ) != 0 {
288267 return nil , validationPhaseError {
289- phase : "YAML parsing" ,
268+ phase : validationPhaseReadmeParsing ,
290269 errors : yamlParsingErrors ,
291270 }
292271 }
293272
294273 employeeGithubGroups := map [string ][]string {}
295274 yamlValidationErrors := []error {}
296275 for _ , p := range profilesByUsername {
297- errors := validateContributorYaml (p )
276+ errors := validateContributorProfile (p )
298277 if len (errors ) > 0 {
299278 yamlValidationErrors = append (yamlValidationErrors , errors ... )
300279 continue
@@ -315,7 +294,7 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil
315294 }
316295 if len (yamlValidationErrors ) != 0 {
317296 return nil , validationPhaseError {
318- phase : "Raw YAML Validation" ,
297+ phase : validationPhaseReadmeValidation ,
319298 errors : yamlValidationErrors ,
320299 }
321300 }
@@ -352,7 +331,7 @@ func aggregateContributorReadmeFiles() ([]readme, error) {
352331
353332 if len (problems ) != 0 {
354333 return nil , validationPhaseError {
355- phase : "FileSystem reading" ,
334+ phase : validationPhaseFilesystemRead ,
356335 errors : problems ,
357336 }
358337 }
@@ -395,7 +374,7 @@ func validateContributorRelativeUrls(
395374 return nil
396375 }
397376 return validationPhaseError {
398- phase : "Relative URL validation" ,
377+ phase : validationPhaseAssetCrossReference ,
399378 errors : problems ,
400379 }
401380}
0 commit comments