@@ -16,7 +16,7 @@ import (
1616
1717const rootRegistryPath = "./registry"
1818
19- type directoryReadme struct {
19+ type readme struct {
2020 FilePath string
2121 RawText string
2222}
@@ -38,16 +38,16 @@ type contributorFrontmatterWithFilePath struct {
3838 FilePath string
3939}
4040
41- var _ error = workflowPhaseError {}
41+ var _ error = validationPhaseError {}
4242
43- type workflowPhaseError struct {
43+ type validationPhaseError struct {
4444 Phase string
4545 Errors []error
4646}
4747
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 {
5151 msg += fmt .Sprintf ("\n - %v" , e )
5252 }
5353 msg += "\n "
@@ -383,12 +383,12 @@ func validateContributorYaml(yml contributorFrontmatterWithFilePath) []error {
383383 return problems
384384}
385385
386- func parseContributorFiles (readmeEntries []directoryReadme ) (
386+ func parseContributorFiles (readmeEntries []readme ) (
387387 map [string ]contributorFrontmatterWithFilePath ,
388388 error ,
389389) {
390390 frontmatterByUsername := map [string ]contributorFrontmatterWithFilePath {}
391- yamlParsingErrors := workflowPhaseError {
391+ yamlParsingErrors := validationPhaseError {
392392 Phase : "YAML parsing" ,
393393 }
394394 for _ , rm := range readmeEntries {
@@ -434,7 +434,7 @@ func parseContributorFiles(readmeEntries []directoryReadme) (
434434 }
435435
436436 employeeGithubGroups := map [string ][]string {}
437- yamlValidationErrors := workflowPhaseError {
437+ yamlValidationErrors := validationPhaseError {
438438 Phase : "Raw YAML Validation" ,
439439 }
440440 for _ , yml := range frontmatterByUsername {
@@ -475,13 +475,13 @@ func parseContributorFiles(readmeEntries []directoryReadme) (
475475 return frontmatterByUsername , nil
476476}
477477
478- func aggregateReadmeFiles () ([]directoryReadme , error ) {
478+ func aggregateContributorReadmeFiles () ([]readme , error ) {
479479 dirEntries , err := os .ReadDir (rootRegistryPath )
480480 if err != nil {
481481 return nil , err
482482 }
483483
484- allReadmeFiles := []directoryReadme {}
484+ allReadmeFiles := []readme {}
485485 problems := []error {}
486486 for _ , e := range dirEntries {
487487 dirPath := path .Join (rootRegistryPath , e .Name ())
@@ -502,14 +502,14 @@ func aggregateReadmeFiles() ([]directoryReadme, error) {
502502 problems = append (problems , err )
503503 continue
504504 }
505- allReadmeFiles = append (allReadmeFiles , directoryReadme {
505+ allReadmeFiles = append (allReadmeFiles , readme {
506506 FilePath : readmePath ,
507507 RawText : string (rmBytes ),
508508 })
509509 }
510510
511511 if len (problems ) != 0 {
512- return nil , workflowPhaseError {
512+ return nil , validationPhaseError {
513513 Phase : "FileSystem reading" ,
514514 Errors : problems ,
515515 }
@@ -552,17 +552,17 @@ func validateRelativeUrls(
552552 if len (problems ) == 0 {
553553 return nil
554554 }
555- return workflowPhaseError {
555+ return validationPhaseError {
556556 Phase : "Relative URL validation" ,
557557 Errors : problems ,
558558 }
559559}
560560
561561func main () {
562562 log .Println ("Starting README validation" )
563- allReadmeFiles , err := aggregateReadmeFiles ()
563+ allReadmeFiles , err := aggregateContributorReadmeFiles ()
564564 if err != nil {
565- panic (err )
565+ log . Panic (err )
566566 }
567567
568568 log .Printf ("Processing %d README files\n " , len (allReadmeFiles ))
0 commit comments