Skip to content

Commit a7bfc66

Browse files
authored
docs: add thanks page (#2893)
1 parent 091a641 commit a7bfc66

File tree

4 files changed

+73
-21
lines changed

4 files changed

+73
-21
lines changed

docs/src/config/sidebar.yml

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
items:
2525
- label: "Roadmap"
2626
link: "/product/roadmap/"
27+
- label: "Thanks"
28+
link: "/product/thanks/"
2729
- label: "Trusted By"
2830
link: "/product/trusted-by/"
2931
- label: "GitHub"

docs/src/docs/product/roadmap.mdx

-9
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ Please file an issue for bugs, missing documentation, or unexpected behavior.
1414

1515
[See Bugs](https://github.com/golangci/golangci-lint/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3A%22bug%22+sort%3Acreated-desc)
1616

17-
## Thanks
18-
19-
Thanks to all [contributors](https://github.com/golangci/golangci-lint/graphs/contributors)!
20-
Thanks to [alecthomas/gometalinter](https://github.com/alecthomas/gometalinter) for inspiration and amazing work.
21-
Thanks to [bradleyfalzon/revgrep](https://github.com/bradleyfalzon/revgrep) for cool diff tool.
22-
23-
Thanks to developers and authors of used linters:
24-
{.ThanksList}
25-
2617
## Changelog
2718

2819
{.ChangeLog}

docs/src/docs/product/thanks.mdx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Thanks
3+
---
4+
5+
## ❤️
6+
7+
Thanks to all [contributors](https://github.com/golangci/golangci-lint/graphs/contributors)!
8+
9+
Thanks to [alecthomas/gometalinter](https://github.com/alecthomas/gometalinter) for inspiration and amazing work.
10+
Thanks to [bradleyfalzon/revgrep](https://github.com/bradleyfalzon/revgrep) for cool diff tool.
11+
12+
Thanks to developers and authors of used linters:
13+
14+
{.ThanksList}

scripts/expand_website_templates/main.go

+57-12
Original file line numberDiff line numberDiff line change
@@ -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+
316322
func 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+
344389
type SettingSnippets struct {
345390
ConfigurationFile string
346391
LintersSettings string

0 commit comments

Comments
 (0)