Abirdcfly 95edd30b41
build(deps): bump github.com/Abirdcfly/dupword from 0.0.12 to 0.0.13 (#4104)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2023-09-25 06:05:11 +02:00

31 lines
695 B
Go

package golinters
import (
"strings"
"github.com/Abirdcfly/dupword"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
func NewDupWord(setting *config.DupWordSettings) *goanalysis.Linter {
a := dupword.NewAnalyzer()
cfgMap := map[string]map[string]any{}
if setting != nil {
cfgMap[a.Name] = map[string]any{
"keyword": strings.Join(setting.Keywords, ","),
"ignore": strings.Join(setting.Ignore, ","),
}
}
return goanalysis.NewLinter(
a.Name,
"checks for duplicate words in the source code",
[]*analysis.Analyzer{a},
cfgMap,
).WithLoadMode(goanalysis.LoadModeSyntax)
}