-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.golangci.yml
139 lines (137 loc) · 5.88 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
run:
tests: false
issues:
exclude-use-default: false
# Override the defaults for each linter specified.
linters-settings:
gocritic:
# https://golangci-lint.run/usage/linters/#gocritic
enabled-tags:
- diagnostic
- opinionated
- performance
- style
disabled-checks:
# causes a crash with some libraries
- hugeParam
# causes a crash with some libraries
- paramTypeCombine
exhaustive:
default-signifies-exhaustive: true
lll:
line-length: 140
# misspell is not enabled by default, but can be for specific projects with --enable "misspell"
misspell:
locale: US
ignore-words:
- localised
- catalogue
godot:
exclude:
- "@(Given|When|Then|And|But) (.*)" # go-relish uses comments to auto-generate code, these lines should not end with a `.`
gci:
custom-order: true
sections:
- standard
- prefix(github.com/PaddleHQ/paddle-go-sdk)
- prefix(github.com/PaddleHQ)
- default
wsl:
allow-assign-and-call: false
force-case-trailing-whitespace: 0
force-err-cuddling: true
allow-cuddle-with-calls: ["Lock", "RLock"]
allow-cuddle-with-rhs: ["Unlock", "RUnlock"]
error-variable-names: ["err"]
gosec:
excludes:
- G115 # Potential integer overflow when converting between integer types
linters:
disable-all: true
enable:
# Checks for unclosed HTTP response body: https://github.com/timakin/bodyclose
- bodyclose
# Checks for struct contained context.Context field: https://github.com/sivchari/containedctx
- containedctx
# Checks function and package cyclomatic complexity: https://github.com/bkielbasa/cyclop
- cyclop
# Checks for assignments with too many blank identifiers (e.g. x, , , _, := f()): https://github.com/alexkohler/dogsled
- dogsled
# Checks for two durations multiplied together: https://github.com/charithe/durationcheck
- durationcheck
# Checks for unchecked errors: https://github.com/kisielk/errcheck
- errcheck
# Checks for pointers to enclosing loop variables: https://github.com/kyoh86/exportloopref
- exportloopref
# Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`: https://github.com/Antonboom/errname
- errname
# Check exhaustiveness of enum switch statements: https://github.com/nishanths/exhaustive
- exhaustive
# Checks for forced type assertions: https://github.com/gostaticanalysis/forcetypeassert
- forcetypeassert
# Checks for long functions: https://github.com/ultraware/funlen
- funlen
# Check the errors handling expressions: https://github.com/Djarvur/go-err113
- goerr113
# Checks the cognitive complexity of functions: https://github.com/uudashr/gocognit
- gocognit
# Checks for repeated strings that could be replaced by a constant: https://github.com/jgautheron/goconst
- goconst
# Checks for bugs, performance and style issues: https://github.com/go-critic/go-critic
- gocritic
# Checks the cyclomatic complexity of functions: https://github.com/fzipp/gocyclo
- gocyclo
# Checks if comments end in a period: https://github.com/tetafro/godot
- godot
# Checks whether code was gofumpt-ed: https://github.com/mvdan/gofumpt
- gofumpt
# Checks for security problems: https://github.com/securego/gosec
- gosec
# Checks if code could be simplified: https://github.com/dominikh/go-tools/tree/master/simple
- gosimple
# Checks for suspicious constructs, such as Printf calls whose arguments do not align with the format string: https://golang.org/cmd/vet/
- govet
# Checks for import ordering
- gci
# Checks for assignments to existing variables are unused: https://github.com/gordonklaus/ineffassign
- ineffassign
# Checks for long lines: https://golangci-lint.run/usage/linters/#lll
- lll
# Checks for slice declarations with non-zero initial length: https://github.com/ashanbrown/makezero
- makezero
# Checks for incorrect spellings: https://github.com/client9/misspell:
- misspell
# Checks for code that returns nil even if it checks that the error is not nil: https://github.com/gostaticanalysis/nilerr
- nilerr
# Checks for deeply nested if statements: https://github.com/nakabonne/nestif
- nestif
# Checks for sending http request without context.Context: https://github.com/sonatard/noctx
- noctx
# Checks for slice declarations that could potentially be pre-allocated: https://github.com/alexkohler/prealloc
- prealloc
# Checks for code that shadows one of Go's predeclared identifiers: https://github.com/nishanths/predeclared
- predeclared
# Fast, configurable, extensible, flexible, and beautiful linter for Go: https://github.com/mgechev/revive
- revive
# Checks for whether Err of rows is checked successfully: https://github.com/jingyugao/rowserrcheck
- rowserrcheck
# https://staticcheck.io/
- staticcheck
# a replacement for golint: https://github.com/dominikh/go-tools/tree/master/stylecheck
- stylecheck
# Checks that sql.Rows and sql.Stmt are closed: https://github.com/ryanrolds/sqlclosecheck
- sqlclosecheck
# linter that makes you use a separate _test package: https://github.com/maratori/testpackage
- testpackage
# Checks for unnecessary type conversions: https://github.com/mdempsky/unconvert
- unconvert
# Checks for unused function parameters: https://github.com/mvdan/unparam
- unparam
# Checks for unused constants, variables, functions and types: https://github.com/dominikh/go-tools/tree/master/unused
- unused
# Checks for wasted assignment statements: https://github.com/sanposhiho/wastedassign
- wastedassign
# Checks for detection of leading and trailing whitespace: https://github.com/ultraware/whitespace
- whitespace
# Whitespace Linter - Forces you to use empty lines!
- wsl