@@ -313,34 +313,79 @@ func spanWithID(id, title, icon string) string {
313313 return fmt .Sprintf (`<span id=%q title=%q>%s</span>` , id , title , icon )
314314}
315315
316+ type authorDetails struct {
317+ Linters []string
318+ Profile string
319+ Avatar string
320+ }
321+
316322func getThanksList () string {
317- var lines [] string
318- addedAuthors := map [ string ] bool {}
323+ addedAuthors := map [ string ] * authorDetails {}
324+
319325 for _ , lc := range lintersdb .NewManager (nil , nil ).GetAllSupportedLinterConfigs () {
320326 if lc .OriginalURL == "" {
321327 continue
322328 }
323329
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"
327333 }
328334
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 {
332355 continue
333356 }
334- addedAuthors [ githubAuthor ] = true
357+ }
335358
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 , ", " )))
339376 }
340377
341378 return strings .Join (lines , "\n " )
342379}
343380
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+
344389type SettingSnippets struct {
345390 ConfigurationFile string
346391 LintersSettings string
0 commit comments