-
Notifications
You must be signed in to change notification settings - Fork 20
/
.golangci.yml
108 lines (108 loc) · 3.66 KB
/
.golangci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
linters-settings:
errcheck:
check-type-assertions: true
forbidigo:
forbid:
- '^fmt\.Print'
- '^log\.'
- '^print$'
- '^println$'
- '^panic$'
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/bufbuild/protocompile) # Custom section: groups all imports with the specified Prefix.
godox:
# TODO, OPT, etc. comments are fine to commit. Use FIXME comments for
# temporary hacks, and use godox to prevent committing them.
keywords: [FIXME]
govet:
enable:
- fieldalignment
varnamelen:
ignore-decls:
- T any
- i int
- wg sync.WaitGroup
linters:
enable-all: true
disable:
# TODO: TCN-350 - initial exclusions for failing linters.
# Should enable all of these?
- depguard
- dupl
- errname
- errorlint
- exhaustive
- exhaustruct
- forbidigo
- forcetypeassert
- gochecknoglobals
- gochecknoinits
- goconst
- gocyclo
- err113
- interfacebloat
- nestif
- nilerr
- nilnil
- nonamedreturns
- thelper
- varnamelen
# Other disabled linters
- cyclop # covered by gocyclo
- execinquery # deprecated in golangci v1.58.0
- funlen # rely on code review to limit function length
- gocognit # dubious "cognitive overhead" quantification
- gofumpt # prefer standard gofmt
- gomnd # some unnamed constants are okay
- inamedparam # named params in interface signatures are not always necessary
- ireturn # "accept interfaces, return structs" isn't ironclad
- lll # don't want hard limits for line length
- maintidx # covered by gocyclo
- mnd # some unnamed constants are okay
- nlreturn # generous whitespace violates house style
- protogetter # lots of false positives: can't use getter to check if field is present
- rowserrcheck # no SQL code in protocompile
- sqlclosecheck # no SQL code in protocompile
- testpackage # internal tests are fine
- wastedassign # not supported with generics
- wrapcheck # don't _always_ need to wrap errors
- wsl # generous whitespace violates house style
issues:
exclude-dirs-use-default: false
exclude-files:
- ".*\\.y\\.go$"
exclude:
# Don't ban use of fmt.Errorf to create new errors, but the remaining
# checks from err113 are useful.
- "do not define dynamic errors.*"
# The integer overflow is excessively noisy since it doesn't seem to
# go away by adding appropriate range checks.
- "G115: integer overflow conversion.*"
exclude-rules:
# Benchmarks can't be run in parallel
- path: benchmark_test\.go
linters:
- paralleltest
# dupword reports several errors in .proto test fixtures
# gosec reports a few minor issues in tests
- path: _test\.go
linters:
- dupword
- gosec
# exclude field alignment linter in tests
- path: _test\.go
text: "fieldalignment:"
linters:
- govet
# exclude fieldalignment "pointer bytes" failures
- text: "pointer bytes"
linters:
- govet