@@ -16,7 +16,7 @@ import (
16
16
17
17
const rootRegistryPath = "./registry"
18
18
19
- type directoryReadme struct {
19
+ type readme struct {
20
20
FilePath string
21
21
RawText string
22
22
}
@@ -38,16 +38,16 @@ type contributorFrontmatterWithFilePath struct {
38
38
FilePath string
39
39
}
40
40
41
- var _ error = workflowPhaseError {}
41
+ var _ error = validationPhaseError {}
42
42
43
- type workflowPhaseError struct {
43
+ type validationPhaseError struct {
44
44
Phase string
45
45
Errors []error
46
46
}
47
47
48
- func (wpe workflowPhaseError ) Error () string {
49
- msg := fmt .Sprintf ("Error during %q phase of README validation:" , wpe .Phase )
50
- for _ , e := range wpe .Errors {
48
+ func (vpe validationPhaseError ) Error () string {
49
+ msg := fmt .Sprintf ("Error during %q phase of README validation:" , vpe .Phase )
50
+ for _ , e := range vpe .Errors {
51
51
msg += fmt .Sprintf ("\n - %v" , e )
52
52
}
53
53
msg += "\n "
@@ -383,12 +383,12 @@ func validateContributorYaml(yml contributorFrontmatterWithFilePath) []error {
383
383
return problems
384
384
}
385
385
386
- func parseContributorFiles (readmeEntries []directoryReadme ) (
386
+ func parseContributorFiles (readmeEntries []readme ) (
387
387
map [string ]contributorFrontmatterWithFilePath ,
388
388
error ,
389
389
) {
390
390
frontmatterByUsername := map [string ]contributorFrontmatterWithFilePath {}
391
- yamlParsingErrors := workflowPhaseError {
391
+ yamlParsingErrors := validationPhaseError {
392
392
Phase : "YAML parsing" ,
393
393
}
394
394
for _ , rm := range readmeEntries {
@@ -434,7 +434,7 @@ func parseContributorFiles(readmeEntries []directoryReadme) (
434
434
}
435
435
436
436
employeeGithubGroups := map [string ][]string {}
437
- yamlValidationErrors := workflowPhaseError {
437
+ yamlValidationErrors := validationPhaseError {
438
438
Phase : "Raw YAML Validation" ,
439
439
}
440
440
for _ , yml := range frontmatterByUsername {
@@ -475,13 +475,13 @@ func parseContributorFiles(readmeEntries []directoryReadme) (
475
475
return frontmatterByUsername , nil
476
476
}
477
477
478
- func aggregateReadmeFiles () ([]directoryReadme , error ) {
478
+ func aggregateContributorReadmeFiles () ([]readme , error ) {
479
479
dirEntries , err := os .ReadDir (rootRegistryPath )
480
480
if err != nil {
481
481
return nil , err
482
482
}
483
483
484
- allReadmeFiles := []directoryReadme {}
484
+ allReadmeFiles := []readme {}
485
485
problems := []error {}
486
486
for _ , e := range dirEntries {
487
487
dirPath := path .Join (rootRegistryPath , e .Name ())
@@ -502,14 +502,14 @@ func aggregateReadmeFiles() ([]directoryReadme, error) {
502
502
problems = append (problems , err )
503
503
continue
504
504
}
505
- allReadmeFiles = append (allReadmeFiles , directoryReadme {
505
+ allReadmeFiles = append (allReadmeFiles , readme {
506
506
FilePath : readmePath ,
507
507
RawText : string (rmBytes ),
508
508
})
509
509
}
510
510
511
511
if len (problems ) != 0 {
512
- return nil , workflowPhaseError {
512
+ return nil , validationPhaseError {
513
513
Phase : "FileSystem reading" ,
514
514
Errors : problems ,
515
515
}
@@ -552,17 +552,17 @@ func validateRelativeUrls(
552
552
if len (problems ) == 0 {
553
553
return nil
554
554
}
555
- return workflowPhaseError {
555
+ return validationPhaseError {
556
556
Phase : "Relative URL validation" ,
557
557
Errors : problems ,
558
558
}
559
559
}
560
560
561
561
func main () {
562
562
log .Println ("Starting README validation" )
563
- allReadmeFiles , err := aggregateReadmeFiles ()
563
+ allReadmeFiles , err := aggregateContributorReadmeFiles ()
564
564
if err != nil {
565
- panic (err )
565
+ log . Panic (err )
566
566
}
567
567
568
568
log .Printf ("Processing %d README files\n " , len (allReadmeFiles ))
0 commit comments