Skip to content

Commit 2bb0190

Browse files
committed
review
1 parent 876adab commit 2bb0190

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

.golangci.reference.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ linters-settings:
225225
threshold: 100
226226

227227
dupword:
228-
# key words for detecting duplicate words, will override default value
229-
# Default: the, and, a
228+
# Keywords for detecting duplicate words, only the words defined in this list will be detected.
229+
# Default: []
230230
keyword:
231231
- "the"
232232
- "and"

pkg/config/linters_settings.go

-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ var defaultLintersSettings = LintersSettings{
1919
Dogsled: DogsledSettings{
2020
MaxBlankIdentifiers: 2,
2121
},
22-
DupWord: DupWordSettings{
23-
KeyWord: []string{"the", "and", "a"},
24-
},
2522
ErrorLint: ErrorLintSettings{
2623
Errorf: true,
2724
Asserts: true,

pkg/golinters/dupword.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@ import (
44
"strings"
55

66
"github.com/Abirdcfly/dupword"
7-
"github.com/golangci/golangci-lint/pkg/config"
87
"golang.org/x/tools/go/analysis"
98

9+
"github.com/golangci/golangci-lint/pkg/config"
1010
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
1111
)
1212

1313
func NewDupWord(setting *config.DupWordSettings) *goanalysis.Linter {
1414
a := dupword.NewAnalyzer()
15+
1516
cfgMap := map[string]map[string]interface{}{}
1617
if setting != nil {
1718
cfgMap[a.Name] = map[string]interface{}{
1819
"keyword": strings.Join(setting.KeyWord, ","),
1920
}
2021
}
22+
2123
return goanalysis.NewLinter(
22-
"dupword",
23-
"checks for duplicate words in the source code (usually miswritten)",
24+
a.Name,
25+
"checks for duplicate words in the source code",
2426
[]*analysis.Analyzer{a},
2527
cfgMap,
2628
).WithLoadMode(goanalysis.LoadModeSyntax)

pkg/lint/lintersdb/manager.go

-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
344344
linter.NewConfig(golinters.NewDupWord(dupwordCfg)).
345345
WithSince("1.50.0").
346346
WithPresets(linter.PresetComment).
347-
WithLoadForGoAnalysis().
348347
WithAutoFix().
349348
WithURL("https://github.com/Abirdcfly/dupword"),
350349

0 commit comments

Comments
 (0)