diff --git a/docs/src/config/sidebar.yml b/docs/src/config/sidebar.yml index 10608d3d8495..b034cdb4c1b2 100644 --- a/docs/src/config/sidebar.yml +++ b/docs/src/config/sidebar.yml @@ -24,6 +24,8 @@ items: - label: "Roadmap" link: "/product/roadmap/" + - label: "Thanks" + link: "/product/thanks/" - label: "Trusted By" link: "/product/trusted-by/" - label: "GitHub" diff --git a/docs/src/docs/product/roadmap.mdx b/docs/src/docs/product/roadmap.mdx index a2ef72b912c2..feb8c409e391 100644 --- a/docs/src/docs/product/roadmap.mdx +++ b/docs/src/docs/product/roadmap.mdx @@ -14,15 +14,6 @@ Please file an issue for bugs, missing documentation, or unexpected behavior. [See Bugs](https://github.com/golangci/golangci-lint/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3A%22bug%22+sort%3Acreated-desc) -## Thanks - -Thanks to all [contributors](https://github.com/golangci/golangci-lint/graphs/contributors)! -Thanks to [alecthomas/gometalinter](https://github.com/alecthomas/gometalinter) for inspiration and amazing work. -Thanks to [bradleyfalzon/revgrep](https://github.com/bradleyfalzon/revgrep) for cool diff tool. - -Thanks to developers and authors of used linters: -{.ThanksList} - ## Changelog {.ChangeLog} diff --git a/docs/src/docs/product/thanks.mdx b/docs/src/docs/product/thanks.mdx new file mode 100644 index 000000000000..6c931130f181 --- /dev/null +++ b/docs/src/docs/product/thanks.mdx @@ -0,0 +1,14 @@ +--- +title: Thanks +--- + +## ❤️ + +Thanks to all [contributors](https://github.com/golangci/golangci-lint/graphs/contributors)! + +Thanks to [alecthomas/gometalinter](https://github.com/alecthomas/gometalinter) for inspiration and amazing work. +Thanks to [bradleyfalzon/revgrep](https://github.com/bradleyfalzon/revgrep) for cool diff tool. + +Thanks to developers and authors of used linters: + +{.ThanksList} diff --git a/scripts/expand_website_templates/main.go b/scripts/expand_website_templates/main.go index ca29f251ab2b..4e8e2dcc3f21 100644 --- a/scripts/expand_website_templates/main.go +++ b/scripts/expand_website_templates/main.go @@ -313,34 +313,79 @@ func spanWithID(id, title, icon string) string { return fmt.Sprintf(`%s`, id, title, icon) } +type authorDetails struct { + Linters []string + Profile string + Avatar string +} + func getThanksList() string { - var lines []string - addedAuthors := map[string]bool{} + addedAuthors := map[string]*authorDetails{} + for _, lc := range lintersdb.NewManager(nil, nil).GetAllSupportedLinterConfigs() { if lc.OriginalURL == "" { continue } - const githubPrefix = "https://github.com/" - if !strings.HasPrefix(lc.OriginalURL, githubPrefix) { - continue + linterURL := lc.OriginalURL + if lc.Name() == "staticcheck" { + linterURL = "https://github.com/dominikh/go-tools" } - githubSuffix := strings.TrimPrefix(lc.OriginalURL, githubPrefix) - githubAuthor := strings.Split(githubSuffix, "/")[0] - if addedAuthors[githubAuthor] { + if author := extractAuthor(linterURL, "https://github.com/"); author != "" && author != "golangci" { + if _, ok := addedAuthors[author]; ok { + addedAuthors[author].Linters = append(addedAuthors[author].Linters, lc.Name()) + } else { + addedAuthors[author] = &authorDetails{ + Linters: []string{lc.Name()}, + Profile: fmt.Sprintf("[%[1]s](https://github.com/sponsors/%[1]s)", author), + Avatar: fmt.Sprintf(`%[1]s`, author), + } + } + } else if author := extractAuthor(linterURL, "https://gitlab.com/"); author != "" { + if _, ok := addedAuthors[author]; ok { + addedAuthors[author].Linters = append(addedAuthors[author].Linters, lc.Name()) + } else { + addedAuthors[author] = &authorDetails{ + Linters: []string{lc.Name()}, + Profile: fmt.Sprintf("[%[1]s](https://gitlab.com/%[1]s)", author), + } + } + } else { continue } - addedAuthors[githubAuthor] = true + } - line := fmt.Sprintf("- [%s](https://github.com/%s)", - githubAuthor, githubAuthor) - lines = append(lines, line) + var authors []string + for author := range addedAuthors { + authors = append(authors, author) + } + + sort.Slice(authors, func(i, j int) bool { + return strings.ToLower(authors[i]) < strings.ToLower(authors[j]) + }) + + lines := []string{ + "|Author|Linter(s)|", + "|---|---|", + } + + for _, author := range authors { + lines = append(lines, fmt.Sprintf("|%s %s|%s|", + addedAuthors[author].Avatar, addedAuthors[author].Profile, strings.Join(addedAuthors[author].Linters, ", "))) } return strings.Join(lines, "\n") } +func extractAuthor(originalURL, prefix string) string { + if !strings.HasPrefix(originalURL, prefix) { + return "" + } + + return strings.SplitN(strings.TrimPrefix(originalURL, prefix), "/", 2)[0] +} + type SettingSnippets struct { ConfigurationFile string LintersSettings string