Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Sep 11, 2022
1 parent 876adab commit d96ecf3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .golangci.reference.yml
Expand Up @@ -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"
Expand Down
3 changes: 0 additions & 3 deletions pkg/config/linters_settings.go
Expand Up @@ -19,9 +19,6 @@ var defaultLintersSettings = LintersSettings{
Dogsled: DogsledSettings{
MaxBlankIdentifiers: 2,
},
DupWord: DupWordSettings{
KeyWord: []string{"the", "and", "a"},
},
ErrorLint: ErrorLintSettings{
Errorf: true,
Asserts: true,
Expand Down
6 changes: 4 additions & 2 deletions pkg/golinters/dupword.go
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion pkg/lint/lintersdb/manager.go
Expand Up @@ -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"),

Expand Down

0 comments on commit d96ecf3

Please sign in to comment.