@@ -16,6 +16,8 @@ import (
16
16
"reflect"
17
17
"sort"
18
18
"strings"
19
+ "unicode"
20
+ "unicode/utf8"
19
21
20
22
"gopkg.in/yaml.v3"
21
23
@@ -302,7 +304,20 @@ func getDesc(lc *linter.Config) string {
302
304
}
303
305
}
304
306
305
- return strings .ReplaceAll (desc , "\n " , "<br/>" )
307
+ return formatDesc (desc )
308
+ }
309
+
310
+ func formatDesc (desc string ) string {
311
+ runes := []rune (desc )
312
+
313
+ r , _ := utf8 .DecodeRuneInString (desc )
314
+ runes [0 ] = unicode .ToUpper (r )
315
+
316
+ if runes [len (runes )- 1 ] != '.' {
317
+ runes = append (runes , '.' )
318
+ }
319
+
320
+ return strings .ReplaceAll (string (runes ), "\n " , "<br/>" )
306
321
}
307
322
308
323
func check (b bool , title string ) string {
@@ -342,6 +357,10 @@ func getThanksList() string {
342
357
addedAuthors := map [string ]* authorDetails {}
343
358
344
359
for _ , lc := range lintersdb .NewManager (nil , nil ).GetAllSupportedLinterConfigs () {
360
+ if lc .Internal {
361
+ continue
362
+ }
363
+
345
364
if lc .OriginalURL == "" {
346
365
continue
347
366
}
@@ -468,7 +487,7 @@ func extractExampleSnippets(example []byte) (*SettingSnippets, error) {
468
487
globalNode .Content = append (globalNode .Content , node , newNode )
469
488
470
489
if node .Value == "linters-settings" {
471
- snippets .LintersSettings , err = getLintersSettingSnippets (node , nextNode )
490
+ snippets .LintersSettings , err = getLintersSettingSections (node , nextNode )
472
491
if err != nil {
473
492
return nil , err
474
493
}
@@ -508,7 +527,19 @@ func extractExampleSnippets(example []byte) (*SettingSnippets, error) {
508
527
return & snippets , nil
509
528
}
510
529
511
- func getLintersSettingSnippets (node , nextNode * yaml.Node ) (string , error ) {
530
+ func getLintersSettingSections (node , nextNode * yaml.Node ) (string , error ) {
531
+ lcs := lintersdb .NewManager (nil , nil ).GetAllSupportedLinterConfigs ()
532
+
533
+ var lintersDesc = make (map [string ]string )
534
+ for _ , lc := range lcs {
535
+ if lc .Internal {
536
+ continue
537
+ }
538
+
539
+ // it's important to use lc.Name() nor name because name can be alias
540
+ lintersDesc [lc .Name ()] = getDesc (lc )
541
+ }
542
+
512
543
builder := & strings.Builder {}
513
544
514
545
for i := 0 ; i < len (nextNode .Content ); i += 2 {
@@ -530,6 +561,7 @@ func getLintersSettingSnippets(node, nextNode *yaml.Node) (string, error) {
530
561
}
531
562
532
563
_ , _ = fmt .Fprintf (builder , "### %s\n \n " , nextNode .Content [i ].Value )
564
+ _ , _ = fmt .Fprintf (builder , "%s\n \n " , lintersDesc [nextNode .Content [i ].Value ])
533
565
_ , _ = fmt .Fprintln (builder , "```yaml" )
534
566
535
567
encoder := yaml .NewEncoder (builder )
0 commit comments