-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yaml
158 lines (156 loc) · 5.19 KB
/
.golangci.yaml
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
---
linters-settings:
nolintlint:
allow-unused: false
require-explanation: true
require-specific: true
goimports:
local-prefixes: github.com/n3tuk/action-pull-requester
gofumpt:
module-path: github.com/n3tuk/action-pull-requester
extra-rules: true
gosec:
includes: [] # all
gosimple:
checks: ["all"]
misspell:
locale: US # UK doesn't seem to work very well
staticcheck:
checks: ["all"]
stylecheck:
checks: ["all"]
whitespace:
multi-if: true
multi-func: true
decorder:
disable-dec-order-check: false
disable-init-func-first-check: false
disable-dec-num-check: false
dogsled:
max-blank-identifiers: 1
errchkjson:
check-error-free-encoding: true
gci:
sections:
- standard
- prefix(github.com/n3tuk)
- default
- dot
custom-order: true
godox:
keywords:
- TODO
- BUG
- FIXME
- NOTE
linters:
enable:
# Set local prefixes in import paths separately from third-party packages
- goimports
# Check Go package import order and make sure it is always deterministic
- gci
# A stricter formatter than gofmt
- gofumpt
# Finds bugs and performance issues and enforces style rule,s
- staticcheck
# Go static analysis tool to enforce style rules in Go source code
- stylecheck
# Go static analysis tool to parse and type-checks Go source code
- typecheck
# Checks that the length of a variable's name matches its scope
- varnamelen
# Check the maintainability of Go source code
- maintidx
# Check Go source code that will cause problems with the error wrapping scheme introduced in Go 1.13
- errorlint
# Checks that exported fields of a struct are annotated with the relevant tag
- musttag
# Check types passed to the JSON encoding functions for unsupported types, etc.
- errchkjson
# Check for ignored error responses
- errcheck
# Check that sentinel errors are prefixed with the Err and error types are suffixed with the Error
- errname
# Check that errors returned from external packages are wrapped
- wrapcheck
# Check that .Close() is called for net/http.Response
- bodyclose
# Check the exhaustiveness of enum switch statements
- exhaustive
# Check for any pointers exported from a loop
- exportloopref
# Check for long functions in code (i.e. lines or statements)
- funlen
# Check for repeated strings in Go code and suggest constants
- goconst
# Another Go linting tool
- gocritic
# Check the cyclomatic complexities of functions in Go source code
- gocyclo
# A vet analyzer to detect magic numbers in Go source code
- gomnd
# A check that Printf-like functions end with an f in their name
- goprintffuncname
# A security checker for Go source code
- gosec
# Check for assignments with too many blank identifiers
- dogsled
# A linter for Go source code that specialises on simplifying code
- gosimple
# Examine Go source code and report suspicious constructs
- govet
# Detect ineffectual assignments in Go source code
- ineffassign
# Forbids certain types of identifiers
- forbidigo
# Correct commonly misspelled English words in Go source files
- misspell
# Go static analysis tool to find naked returns in large functions
- nakedret
# Detect sending http request without context.Context types
- noctx
# Check whether the function uses a non-inherited context
- contextcheck
# Go static analysis tool to find poor //nolint directives
- nolintlint
# Check for unnecessary type conversions in Go source code
- unconvert
# Go static analysis tool to check for unused function parameters
- unparam
# Check Go source code for unused constants, variables, functions, and type
- unused
# Check for unnecessary newlines at the start and end of functions, if, for, etc.
- whitespace
# A whitespace linter to try and insert more whitespace in Go source code
- wsl
# Check declaration order and count of types, constants, variables and functions
- decorder
# Check for two durations multiplied together
- durationcheck
# Check for detection of TODO and other comment keywords
- godox
# Check for slice declarations with non-zero initial length
- makezero
# Check for no simultaneous return of nil error and an invalid value
- nilnil
# Check for misuse of Sprintf to construct a host with port in a URL
- nosprintfhostport
# Check whether err of rows is checked successfully
- rowserrcheck
# Check that sql.Rows and sql.Stmt are closed
- sqlclosecheck
# Go static analysis that detects using os.Setenv instead of t.Setenv
- tenv
# Detect Go test helpers without t.Helper() call
- thelper
# Check that a separate _test package is used for testing
- testpackage
disable:
# Check if all structure fields are initialized
# (this is very noisy and many structs don't need to be complete)
- exhaustruct
# Check for slice declarations that could potentially be pre-allocated
# (should be done as part of performance testing)
- prealloc
run:
timeout: 1m