Abirdcfly / dupword

A linter that checks for duplicate words in the source code (usually miswritten)
MIT License
13 stars 5 forks source link

False positives with repeated numbers #7

Closed twpayne closed 1 year ago

twpayne commented 1 year ago

I'm using dupword through golangci-lint version 1.50.1, which uses dupword v0.0.7. From looking at the changes since I don't think the latest release of dupword (v0.0.8) fixes the issue, although I admit I have not actually tested this.

I'm getting false positives on number values in strings:

shapefile_test.go:35:42: Duplicate words (5,5) found (dupword)
                        expectedGeom0:      newGeomFromWKT(t, "MULTILINESTRING ((1 5,5 5,5 1,3 3,1 1),(3 2,2 6))"),
                                                              ^
shapefile_test.go:92:42: Duplicate words (60,120) found (dupword)
                        expectedGeom0:      newGeomFromWKT(t, "POLYGON ((-120 60,120 60,120 -60,-120 -60,-120 60),(-60 30,-60 -30,60 -30,60 30,-60 30))"),

Note that the duplicated words are 5,5 and 60,120, which aren't words at all. The lines in their full context are at https://github.com/twpayne/go-shapefile/blob/65f0f2d54aee08071337af8be53dbc55680a056a/shapefile_test.go#L35 and https://github.com/twpayne/go-shapefile/blob/65f0f2d54aee08071337af8be53dbc55680a056a/shapefile_test.go#L92.

Clearly, these are false positives and dupword should not report them.