Skip to content

Commit a56a924

Browse files
tfrankow-intelartek-koltun
authored andcommitted
ci(lint): exclude goconst linter from test files
Repeated string literals in table-driven tests are idiomatic Go and do not need to be extracted into constants. This suppresses 385 goconst warnings that only appear in _test.go files. Also set goconst ignore-tests so test-file occurrences are not counted toward the threshold for production code strings, and raise min-occurrences to 4 to avoid false positives on strings like "TBD" that appear only a few times in production code. Signed-off-by: Frankowski, Tomasz <tomasz.frankowski@intel.com>
1 parent 1e40611 commit a56a924

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ linters:
3737
funlen:
3838
lines: 120
3939
statements: 120
40+
goconst:
41+
ignore-tests: true
42+
min-occurrences: 4
4043
dupl:
4144
threshold: 200
4245
gocognit:
@@ -55,6 +58,7 @@ linters:
5558
- path: (.+)_test.go
5659
linters:
5760
- funlen
61+
- goconst
5862
- gochecknoglobals
5963
- gocritic
6064
- gocognit

0 commit comments

Comments
 (0)