docs: add thanks page (#2893)
This commit is contained in:
parent
091a641f91
commit
a7bfc66740
@ -24,6 +24,8 @@
|
|||||||
items:
|
items:
|
||||||
- label: "Roadmap"
|
- label: "Roadmap"
|
||||||
link: "/product/roadmap/"
|
link: "/product/roadmap/"
|
||||||
|
- label: "Thanks"
|
||||||
|
link: "/product/thanks/"
|
||||||
- label: "Trusted By"
|
- label: "Trusted By"
|
||||||
link: "/product/trusted-by/"
|
link: "/product/trusted-by/"
|
||||||
- label: "GitHub"
|
- 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)
|
[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
|
||||||
|
|
||||||
{.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)
|
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 {
|
func getThanksList() string {
|
||||||
var lines []string
|
addedAuthors := map[string]*authorDetails{}
|
||||||
addedAuthors := map[string]bool{}
|
|
||||||
for _, lc := range lintersdb.NewManager(nil, nil).GetAllSupportedLinterConfigs() {
|
for _, lc := range lintersdb.NewManager(nil, nil).GetAllSupportedLinterConfigs() {
|
||||||
if lc.OriginalURL == "" {
|
if lc.OriginalURL == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
const githubPrefix = "https://github.com/"
|
linterURL := lc.OriginalURL
|
||||||
if !strings.HasPrefix(lc.OriginalURL, githubPrefix) {
|
if lc.Name() == "staticcheck" {
|
||||||
continue
|
linterURL = "https://github.com/dominikh/go-tools"
|
||||||
}
|
}
|
||||||
|
|
||||||
githubSuffix := strings.TrimPrefix(lc.OriginalURL, githubPrefix)
|
if author := extractAuthor(linterURL, "https://github.com/"); author != "" && author != "golangci" {
|
||||||
githubAuthor := strings.Split(githubSuffix, "/")[0]
|
if _, ok := addedAuthors[author]; ok {
|
||||||
if addedAuthors[githubAuthor] {
|
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
|
continue
|
||||||
}
|
}
|
||||||
addedAuthors[githubAuthor] = true
|
}
|
||||||
|
|
||||||
line := fmt.Sprintf("- [%s](https://github.com/%s)",
|
var authors []string
|
||||||
githubAuthor, githubAuthor)
|
for author := range addedAuthors {
|
||||||
lines = append(lines, line)
|
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")
|
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 {
|
type SettingSnippets struct {
|
||||||
ConfigurationFile string
|
ConfigurationFile string
|
||||||
LintersSettings string
|
LintersSettings string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user