@@ -33,27 +33,6 @@ type contributorProfile struct {
33
33
filePath string
34
34
}
35
35
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
-
57
36
func validateContributorGithubUsername (githubUsername string ) error {
58
37
if githubUsername == "" {
59
38
return errors .New ("missing GitHub username" )
@@ -219,7 +198,7 @@ func addFilePathToError(filePath string, err error) error {
219
198
return fmt .Errorf ("%q: %v" , filePath , err )
220
199
}
221
200
222
- func validateContributorYaml (yml contributorProfile ) []error {
201
+ func validateContributorProfile (yml contributorProfile ) []error {
223
202
allProblems := []error {}
224
203
225
204
if err := validateContributorGithubUsername (yml .frontmatter .GithubUsername ); err != nil {
@@ -286,15 +265,15 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil
286
265
}
287
266
if len (yamlParsingErrors ) != 0 {
288
267
return nil , validationPhaseError {
289
- phase : "YAML parsing" ,
268
+ phase : validationPhaseReadmeParsing ,
290
269
errors : yamlParsingErrors ,
291
270
}
292
271
}
293
272
294
273
employeeGithubGroups := map [string ][]string {}
295
274
yamlValidationErrors := []error {}
296
275
for _ , p := range profilesByUsername {
297
- errors := validateContributorYaml (p )
276
+ errors := validateContributorProfile (p )
298
277
if len (errors ) > 0 {
299
278
yamlValidationErrors = append (yamlValidationErrors , errors ... )
300
279
continue
@@ -315,7 +294,7 @@ func parseContributorFiles(readmeEntries []readme) (map[string]contributorProfil
315
294
}
316
295
if len (yamlValidationErrors ) != 0 {
317
296
return nil , validationPhaseError {
318
- phase : "Raw YAML Validation" ,
297
+ phase : validationPhaseReadmeValidation ,
319
298
errors : yamlValidationErrors ,
320
299
}
321
300
}
@@ -352,7 +331,7 @@ func aggregateContributorReadmeFiles() ([]readme, error) {
352
331
353
332
if len (problems ) != 0 {
354
333
return nil , validationPhaseError {
355
- phase : "FileSystem reading" ,
334
+ phase : validationPhaseFilesystemRead ,
356
335
errors : problems ,
357
336
}
358
337
}
@@ -395,7 +374,7 @@ func validateContributorRelativeUrls(
395
374
return nil
396
375
}
397
376
return validationPhaseError {
398
- phase : "Relative URL validation" ,
377
+ phase : validationPhaseAssetCrossReference ,
399
378
errors : problems ,
400
379
}
401
380
}
0 commit comments