Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add thanks page #2893

Merged
merged 4 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/src/config/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
items:
- label: "Roadmap"
link: "/product/roadmap/"
- label: "Thanks"
link: "/product/thanks/"
- label: "Trusted By"
link: "/product/trusted-by/"
- label: "GitHub"
Expand Down
9 changes: 0 additions & 9 deletions docs/src/docs/product/roadmap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
14 changes: 14 additions & 0 deletions docs/src/docs/product/thanks.mdx
Original file line number Diff line number Diff line change
@@ -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}
69 changes: 57 additions & 12 deletions scripts/expand_website_templates/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,34 +313,79 @@ func spanWithID(id, title, icon string) string {
return fmt.Sprintf(`<span id=%q title=%q>%s</span>`, 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(`<img src="https://github.com/%[1]s.png" alt="%[1]s" style="max-width: 100%%;" width="20px;" />`, 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
Expand Down