Skip to content

Commit 0eefc6c

Browse files
twpayneAbirdcfly
authored andcommitted
fix: don't warn on duplicate numbers
1 parent ce5f3f4 commit 0eefc6c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

dupword.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ func (a *analyzer) Check(raw string) (update string, keyword string, find bool)
289289
// e.g. %s, </div> should not be reported.
290290
func ExcludeWords(word string) (exclude bool) {
291291
firstRune, _ := utf8.DecodeRuneInString(word)
292+
if unicode.IsDigit(firstRune) {
293+
return true
294+
}
292295
if unicode.IsPunct(firstRune) {
293296
return true
294297
}

dupword_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,12 @@ func TestExcludeWords(t *testing.T) {
194194
{
195195
name: "number should not exclude",
196196
args: args{word: "3"},
197-
wantExclude: false,
197+
wantExclude: true,
198+
},
199+
{
200+
name: "number,number should exclude",
201+
args: args{word: "3,3 3,3"},
202+
wantExclude: true,
198203
},
199204
{
200205
name: "%s should exclude",

0 commit comments

Comments
 (0)