mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
docs: add a section about default exclusions (#3117)
This commit is contained in:
parent
2b4c9ab4fc
commit
d286cb910c
5 changed files with 45 additions and 6 deletions
|
@ -212,6 +212,7 @@ func buildTemplateContext() (map[string]string, error) {
|
|||
"LintersCommandOutputDisabledOnly": string(lintersOutParts[1]),
|
||||
"EnabledByDefaultLinters": getLintersListMarkdown(true),
|
||||
"DisabledByDefaultLinters": getLintersListMarkdown(false),
|
||||
"DefaultExclusions": getDefaultExclusions(),
|
||||
"ThanksList": getThanksList(),
|
||||
"RunHelpText": string(shortHelp),
|
||||
"ChangeLog": string(changeLog),
|
||||
|
@ -219,6 +220,21 @@ func buildTemplateContext() (map[string]string, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func getDefaultExclusions() string {
|
||||
bufferString := bytes.NewBufferString("")
|
||||
|
||||
for _, pattern := range config.DefaultExcludePatterns {
|
||||
_, _ = fmt.Fprintln(bufferString)
|
||||
_, _ = fmt.Fprintf(bufferString, "### %s\n", pattern.ID)
|
||||
_, _ = fmt.Fprintln(bufferString)
|
||||
_, _ = fmt.Fprintf(bufferString, "- linter: `%s`\n", pattern.Linter)
|
||||
_, _ = fmt.Fprintf(bufferString, "- pattern: `%s`\n", strings.ReplaceAll(pattern.Pattern, "`", "`"))
|
||||
_, _ = fmt.Fprintf(bufferString, "- why: %s\n", pattern.Why)
|
||||
}
|
||||
|
||||
return bufferString.String()
|
||||
}
|
||||
|
||||
func getLintersListMarkdown(enabled bool) string {
|
||||
var neededLcs []*linter.Config
|
||||
lcs := lintersdb.NewManager(nil, nil).GetAllSupportedLinterConfigs()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue