docs: add thanks page (#2893)
This commit is contained in:
parent
091a641f91
commit
a7bfc66740
@ -24,6 +24,8 @@
|
||||
items:
|
||||
- label: "Roadmap"
|
||||
link: "/product/roadmap/"
|
||||
- label: "Thanks"
|
||||
link: "/product/thanks/"
|
||||
- label: "Trusted By"
|
||||
link: "/product/trusted-by/"
|
||||
- label: "GitHub"
|
||||
|
@ -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}
|
||||
|
14
docs/src/docs/product/thanks.mdx
Normal file
14
docs/src/docs/product/thanks.mdx
Normal file
@ -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}
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user