diff --git a/.golangci.reference.yml b/.golangci.reference.yml index edf129b17949..abd57ade52cc 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -225,8 +225,8 @@ linters-settings: threshold: 100 dupword: - # key words for detecting duplicate words, will override default value - # Default: the, and, a + # Keywords for detecting duplicate words, only the words defined in this list will be detected. + # Default: [] keyword: - "the" - "and" diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 83ce3e600140..8ae0a5a5f253 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -19,9 +19,6 @@ var defaultLintersSettings = LintersSettings{ Dogsled: DogsledSettings{ MaxBlankIdentifiers: 2, }, - DupWord: DupWordSettings{ - KeyWord: []string{"the", "and", "a"}, - }, ErrorLint: ErrorLintSettings{ Errorf: true, Asserts: true, diff --git a/pkg/golinters/dupword.go b/pkg/golinters/dupword.go index 2a1ccc1ea571..e61d58544b6a 100644 --- a/pkg/golinters/dupword.go +++ b/pkg/golinters/dupword.go @@ -12,15 +12,17 @@ import ( func NewDupWord(setting *config.DupWordSettings) *goanalysis.Linter { a := dupword.NewAnalyzer() + cfgMap := map[string]map[string]interface{}{} if setting != nil { cfgMap[a.Name] = map[string]interface{}{ "keyword": strings.Join(setting.KeyWord, ","), } } + return goanalysis.NewLinter( - "dupword", - "checks for duplicate words in the source code (usually miswritten)", + a.Name, + "checks for duplicate words in the source code", []*analysis.Analyzer{a}, cfgMap, ).WithLoadMode(goanalysis.LoadModeSyntax) diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 905d04b73545..cf98afd2fdfe 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -344,7 +344,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { linter.NewConfig(golinters.NewDupWord(dupwordCfg)). WithSince("1.50.0"). WithPresets(linter.PresetComment). - WithLoadForGoAnalysis(). WithAutoFix(). WithURL("https://github.com/Abirdcfly/dupword"),