@@ -313,34 +313,79 @@ func spanWithID(id, title, icon string) string {
313
313
return fmt .Sprintf (`<span id=%q title=%q>%s</span>` , id , title , icon )
314
314
}
315
315
316
+ type authorDetails struct {
317
+ Linters []string
318
+ Profile string
319
+ Avatar string
320
+ }
321
+
316
322
func getThanksList () string {
317
- var lines [] string
318
- addedAuthors := map [ string ] bool {}
323
+ addedAuthors := map [ string ] * authorDetails {}
324
+
319
325
for _ , lc := range lintersdb .NewManager (nil , nil ).GetAllSupportedLinterConfigs () {
320
326
if lc .OriginalURL == "" {
321
327
continue
322
328
}
323
329
324
- const githubPrefix = "https://github.com/"
325
- if ! strings . HasPrefix ( lc .OriginalURL , githubPrefix ) {
326
- continue
330
+ linterURL := lc . OriginalURL
331
+ if lc .Name () == "staticcheck" {
332
+ linterURL = "https://github.com/dominikh/go-tools"
327
333
}
328
334
329
- githubSuffix := strings .TrimPrefix (lc .OriginalURL , githubPrefix )
330
- githubAuthor := strings .Split (githubSuffix , "/" )[0 ]
331
- if addedAuthors [githubAuthor ] {
335
+ if author := extractAuthor (linterURL , "https://github.com/" ); author != "" && author != "golangci" {
336
+ if _ , ok := addedAuthors [author ]; ok {
337
+ addedAuthors [author ].Linters = append (addedAuthors [author ].Linters , lc .Name ())
338
+ } else {
339
+ addedAuthors [author ] = & authorDetails {
340
+ Linters : []string {lc .Name ()},
341
+ Profile : fmt .Sprintf ("[%[1]s](https://github.com/sponsors/%[1]s)" , author ),
342
+ Avatar : fmt .Sprintf (`<img src="https://github.com/%[1]s.png" alt="%[1]s" style="max-width: 100%%;" width="20px;" />` , author ),
343
+ }
344
+ }
345
+ } else if author := extractAuthor (linterURL , "https://gitlab.com/" ); author != "" {
346
+ if _ , ok := addedAuthors [author ]; ok {
347
+ addedAuthors [author ].Linters = append (addedAuthors [author ].Linters , lc .Name ())
348
+ } else {
349
+ addedAuthors [author ] = & authorDetails {
350
+ Linters : []string {lc .Name ()},
351
+ Profile : fmt .Sprintf ("[%[1]s](https://gitlab.com/%[1]s)" , author ),
352
+ }
353
+ }
354
+ } else {
332
355
continue
333
356
}
334
- addedAuthors [ githubAuthor ] = true
357
+ }
335
358
336
- line := fmt .Sprintf ("- [%s](https://github.com/%s)" ,
337
- githubAuthor , githubAuthor )
338
- lines = append (lines , line )
359
+ var authors []string
360
+ for author := range addedAuthors {
361
+ authors = append (authors , author )
362
+ }
363
+
364
+ sort .Slice (authors , func (i , j int ) bool {
365
+ return strings .ToLower (authors [i ]) < strings .ToLower (authors [j ])
366
+ })
367
+
368
+ lines := []string {
369
+ "|Author|Linter(s)|" ,
370
+ "|---|---|" ,
371
+ }
372
+
373
+ for _ , author := range authors {
374
+ lines = append (lines , fmt .Sprintf ("|%s %s|%s|" ,
375
+ addedAuthors [author ].Avatar , addedAuthors [author ].Profile , strings .Join (addedAuthors [author ].Linters , ", " )))
339
376
}
340
377
341
378
return strings .Join (lines , "\n " )
342
379
}
343
380
381
+ func extractAuthor (originalURL , prefix string ) string {
382
+ if ! strings .HasPrefix (originalURL , prefix ) {
383
+ return ""
384
+ }
385
+
386
+ return strings .SplitN (strings .TrimPrefix (originalURL , prefix ), "/" , 2 )[0 ]
387
+ }
388
+
344
389
type SettingSnippets struct {
345
390
ConfigurationFile string
346
391
LintersSettings string
0 commit comments