Skip to content

Commit

Permalink
docs: improve linter authors page
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Feb 12, 2025
1 parent c4c1006 commit 2b74eba
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions scripts/website/expand_templates/thanks.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@ func getThanksList() string {
continue
}

linterURL := lc.OriginalURL
if lc.Name() == "staticcheck" {
linterURL = "https://github.com/dominikh/go-tools"
}

if strings.HasPrefix(lc.OriginalURL, "https://github.com/gostaticanalysis/") {
linterURL = "https://github.com/tenntenn/gostaticanalysis"
}
linterURL := extractLinterURL(lc)

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

func extractLinterURL(lc *linter.Config) string {
switch lc.Name() {
case "staticcheck":
return "https://github.com/dominikh/go-tools"

case "depguard":
return "https://github.com/dixonwille/depguard"

default:
if strings.HasPrefix(lc.OriginalURL, "https://github.com/gostaticanalysis/") {
return "https://github.com/tenntenn/gostaticanalysis"
}

if strings.HasPrefix(lc.OriginalURL, "https://github.com/go-simpler/") {
return "https://github.com/tmzane/go-simpler"
}

return lc.OriginalURL
}
}

func extractAuthor(originalURL, prefix string) string {
if !strings.HasPrefix(originalURL, prefix) {
return ""
Expand Down

0 comments on commit 2b74eba

Please sign in to comment.