Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump github.com/Abirdcfly/dupword from 0.0.12 to 0.0.13 #4104

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,13 @@ linters-settings:
# If this list is not empty, only the words defined in this list will be detected.
# Default: []
keywords:
- "the"
- "and"
- "a"
- "the"
- "and"
- "a"
# Keywords used to ignore detection.
# Default: []
ignore:
- "0C0C"

errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
4d63.com/gocheckcompilerdirectives v1.2.1
4d63.com/gochecknoglobals v0.2.1
github.com/4meepo/tagalign v1.3.2
github.com/Abirdcfly/dupword v0.0.12
github.com/Abirdcfly/dupword v0.0.13
github.com/Antonboom/errname v0.1.12
github.com/Antonboom/nilnil v0.1.7
github.com/BurntSushi/toml v1.3.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ type DuplSettings struct {

type DupWordSettings struct {
Keywords []string `mapstructure:"keywords"`
Ignore []string `mapstructure:"ignore"`
}

type ErrcheckSettings struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/golinters/dupword.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func NewDupWord(setting *config.DupWordSettings) *goanalysis.Linter {
if setting != nil {
cfgMap[a.Name] = map[string]any{
"keyword": strings.Join(setting.Keywords, ","),
"ignore": strings.Join(setting.Ignore, ","),
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/testdata/configs/dupword_ignore_the.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
linters-settings:
dupword:
ignore:
- "the"
16 changes: 16 additions & 0 deletions test/testdata/dupword_ignore_the.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//golangcitest:args -Edupword
//golangcitest:config_path testdata/configs/dupword_ignore_the.yml
package testdata

import "fmt"

func duplicateWordInComments() {
// this line include duplicated word the the
fmt.Println("hello")
}

func duplicateWordInStr() {
a := "this line include duplicate word and and" // want `Duplicate words \(and\) found`
b := "print the\n the line, print the the \n\t the line. and and" // want `Duplicate words \(and\) found`
fmt.Println(a, b)
}