Skip to content

Commit 2b74eba

Browse files
committed
docs: improve linter authors page
1 parent c4c1006 commit 2b74eba

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

scripts/website/expand_templates/thanks.go

+22-8
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,7 @@ func getThanksList() string {
3535
continue
3636
}
3737

38-
linterURL := lc.OriginalURL
39-
if lc.Name() == "staticcheck" {
40-
linterURL = "https://github.com/dominikh/go-tools"
41-
}
42-
43-
if strings.HasPrefix(lc.OriginalURL, "https://github.com/gostaticanalysis/") {
44-
linterURL = "https://github.com/tenntenn/gostaticanalysis"
45-
}
38+
linterURL := extractLinterURL(lc)
4639

4740
if author := extractAuthor(linterURL, "https://github.com/"); author != "" && author != "golangci" {
4841
if _, ok := addedAuthors[author]; ok {
@@ -85,6 +78,27 @@ func getThanksList() string {
8578
return strings.Join(lines, "\n")
8679
}
8780

81+
func extractLinterURL(lc *linter.Config) string {
82+
switch lc.Name() {
83+
case "staticcheck":
84+
return "https://github.com/dominikh/go-tools"
85+
86+
case "depguard":
87+
return "https://github.com/dixonwille/depguard"
88+
89+
default:
90+
if strings.HasPrefix(lc.OriginalURL, "https://github.com/gostaticanalysis/") {
91+
return "https://github.com/tenntenn/gostaticanalysis"
92+
}
93+
94+
if strings.HasPrefix(lc.OriginalURL, "https://github.com/go-simpler/") {
95+
return "https://github.com/tmzane/go-simpler"
96+
}
97+
98+
return lc.OriginalURL
99+
}
100+
}
101+
88102
func extractAuthor(originalURL, prefix string) string {
89103
if !strings.HasPrefix(originalURL, prefix) {
90104
return ""

0 commit comments

Comments
 (0)