@@ -556,9 +556,11 @@ func getFeatureMaturityLevel(category string) ([]maturityLevel, error) {
556
556
// the third row is the status
557
557
scanner .Scan ()
558
558
ss := strings .Split (scanner .Text (), "|" )
559
- if len (ss ) > 2 {
560
- status = strings . ToLower ( strings . TrimSpace ( ss [ 2 ]) )
559
+ if len (ss ) < 3 {
560
+ return fmt . Errorf ( "status is missing in the `## Attribute` table of %s" , path )
561
561
}
562
+
563
+ status = strings .ToLower (strings .TrimSpace (ss [2 ]))
562
564
break
563
565
}
564
566
}
@@ -614,22 +616,32 @@ func lintFeatureMaturityLevel() error {
614
616
615
617
for category , recs := range records {
616
618
for _ , record := range recs {
617
- if record .Status == "experimental" && record .ExperimentalSince == "" {
618
- return fmt .Errorf ("experimental_since of %s %s is missing in %s" , category , record .Name , recordFile )
619
+ if record .Status == "experimental" {
620
+ if record .ExperimentalSince == "" {
621
+ return fmt .Errorf ("experimental_since of %s %s is missing in %s" , category , record .Name , recordFile )
622
+ }
623
+ } else if record .Status == "stable" {
624
+ if record .StableSince == "" {
625
+ return fmt .Errorf ("stable_since of %s %s is missing in %s" , category , record .Name , recordFile )
626
+ }
627
+ } else {
628
+ return fmt .Errorf ("status '%s' of %s %s is invalid in %s" , record .Status , category , record .Name , recordFile )
619
629
}
630
+
620
631
found := false
621
632
for i , r := range actualRecords [category ] {
622
633
if r .Name == record .Name {
623
634
found = true
624
635
if r .Status != record .Status {
625
- return fmt .Errorf ("status of %s %s is mismatched between %s and the documentation" , category , record .Name , recordFile )
636
+ return fmt .Errorf ("status of %s %s is mismatched between %s and the documentation. Please update the record in %s." ,
637
+ category , record .Name , recordFile , recordFile )
626
638
}
627
639
actualRecords [category ] = slices .Delete (actualRecords [category ], i , i + 1 )
628
640
break
629
641
}
630
642
}
631
643
if ! found {
632
- return fmt .Errorf ("%s %s is missing in the documentation" , category , record .Name )
644
+ return fmt .Errorf ("feature maturity record of %s %s is missing in the documentation" , category , record .Name )
633
645
}
634
646
}
635
647
}
0 commit comments