diff --git a/pkg/golinters/errorlint.go b/pkg/golinters/errorlint.go index 5b656d140a72..1c9ede203a63 100644 --- a/pkg/golinters/errorlint.go +++ b/pkg/golinters/errorlint.go @@ -19,7 +19,7 @@ func NewErrorLint(cfg *config.ErrorLintSettings) *goanalysis.Linter { return goanalysis.NewLinter( "errorlint", "go-errorlint is a source code linter for Go software "+ - "that can be used to find code that will cause problems"+ + "that can be used to find code that will cause problems "+ "with the error wrapping scheme introduced in Go 1.13.", []*analysis.Analyzer{a}, cfgMap, diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 6dd28f05de02..b8a84ac973a6 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -237,6 +237,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithLoadForGoAnalysis(). WithURL("https://github.com/denis-tingajkin/go-header"), linter.NewConfig(golinters.NewGci()). + WithPresets(linter.PresetFormatting). WithLoadForGoAnalysis(). WithAutoFix(). WithURL("https://github.com/daixiang0/gci"), @@ -254,8 +255,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithAutoFix(). WithURL("https://github.com/client9/misspell"), linter.NewConfig(golinters.NewLLL()). - WithPresets(linter.PresetStyle). - WithURL("https://github.com/walle/lll"), + WithPresets(linter.PresetStyle), linter.NewConfig(golinters.NewUnparam()). WithPresets(linter.PresetUnused). WithLoadForGoAnalysis(). diff --git a/scripts/expand_website_templates/main.go b/scripts/expand_website_templates/main.go index 84057b23a271..8e6f379a2e13 100644 --- a/scripts/expand_website_templates/main.go +++ b/scripts/expand_website_templates/main.go @@ -225,21 +225,56 @@ func getLintersListMarkdown(enabled bool) string { sort.Slice(neededLcs, func(i, j int) bool { return neededLcs[i].Name() < neededLcs[j].Name() }) - var lines []string + + lines := []string{ + "|Name|Description|Presets|AutoFix|Deprecated|", + "|---|---|---|---|---|", + } + for _, lc := range neededLcs { - var link string - if lc.OriginalURL != "" { - link = fmt.Sprintf("[%s](%s)", lc.Name(), lc.OriginalURL) - } else { - link = lc.Name() - } - line := fmt.Sprintf("- %s - %s", link, lc.Linter.Desc()) + line := fmt.Sprintf("|%s|%s|%s|%v|%s|", + getName(lc), + getDesc(lc), + strings.Join(lc.InPresets, ", "), + check(lc.CanAutoFix, "Auto fix supported"), + check(lc.DeprecatedMessage != "", "Deprecated"), + ) lines = append(lines, line) } return strings.Join(lines, "\n") } +func getName(lc *linter.Config) string { + name := lc.Name() + + if lc.OriginalURL != "" { + name = fmt.Sprintf("[%s](%s)", lc.Name(), lc.OriginalURL) + } + + if lc.DeprecatedMessage != "" { + name += ` ` + } + + return name +} + +func getDesc(lc *linter.Config) string { + desc := lc.Linter.Desc() + if lc.DeprecatedMessage != "" { + desc = lc.DeprecatedMessage + } + + return strings.ReplaceAll(desc, "\n", "
") +} + +func check(b bool, title string) string { + if b { + return `` + } + return "" +} + func getThanksList() string { var lines []string addedAuthors := map[string]bool{}