-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy path.golangci.yml
More file actions
119 lines (119 loc) · 3.66 KB
/
.golangci.yml
File metadata and controls
119 lines (119 loc) · 3.66 KB
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
109
110
111
112
113
114
115
116
117
118
119
version: "2"
linters:
default: all
disable:
# TODO: TCN-350 - initial exclusions for failing linters.
# Should enable all of these?
- depguard
- dupl
- embeddedstructfieldcheck
- err113
- errname
- errorlint
- exhaustive
- exhaustruct
- forbidigo
- forcetypeassert
- funcorder
- gochecknoglobals
- gochecknoinits
- goconst
- gocyclo
- godoclint
- interfacebloat
- modernize
- nestif
- nilerr
- nilnil
- noctx
- noinlineerr
- nonamedreturns
- paralleltest
- thelper
- varnamelen
# Other disabled linters
- cyclop # covered by gocyclo
- funlen # rely on code review to limit function length
- gocognit # dubious "cognitive overhead" quantification
- 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 # deprecated
- wsl_v5 # generous whitespace violates house style
settings:
errcheck:
check-type-assertions: true
forbidigo:
forbid:
- pattern: ^fmt\.Print
- pattern: ^log\.
- pattern: ^print$
- pattern: ^println$
- pattern: ^panic$
godox:
# TODO, OPT, etc. comments are fine to commit. Use FIXME comments for
# temporary hacks, and use godox to prevent committing them.
keywords:
- FIXME
gosec:
excludes:
# The integer overflow is excessively noisy since it doesn't seem to
# go away by adding appropriate range checks.
- G115
- G602
- G703
govet:
enable:
- fieldalignment
staticcheck:
checks:
- "all"
- -SA1019
- -QF*
exclusions:
warn-unused: true
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# dupword reports several errors in .proto test fixtures
# gosec reports a few minor issues in tests
- linters:
- dupword
- gosec
path: _test\.go
# exclude field alignment linter in tests
- linters: [govet]
path: _test\.go
text: 'fieldalignment:'
# exclude fieldalignment "pointer bytes" failures
- linters: [govet]
text: pointer bytes
paths:
- .*\.y\.go$
formatters:
enable:
- gci
- gofmt
settings:
# 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"]
gci:
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.