-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yaml
94 lines (92 loc) · 5.26 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
run:
timeout: 5m
tests: true
linters:
disable-all: true
enable:
- asasalint # Check for pass []any as any in variadic func(...any)
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
- bidichk # Checks for dangerous unicode character sequences
- bodyclose # Checks whether HTTP response body is closed successfully.
- containedctx # Linter that detects struct contained context.Context field
- contextcheck # Check whether the function uses a non-inherited context
- dogsled # Checks assignments with too many blank identifiers (e.g. x, , , _, := f()).
- dupword # Checks for duplicate words in the source code
- durationcheck # Check for two durations multiplied together
- errcheck # Checks for unchecked errors.
- errchkjson # Checks types passed to the json encoding functions.
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
- errorlint # Find code that will cause problems with the error wrapping scheme introduced in Go 1.13
- exhaustive # Checks that switches and enum-like structures have all possible cases.
- exportloopref # Checks for exporting pointers to loop variables.
- forcetypeassert # Finds forced type assertions without success check.
- gci # Controls Go package import order and makes it always deterministic. goimports does not check groups.
- gocheckcompilerdirectives # Checks that go compiler directive comments (//go:) are valid.
- gochecknoinits # Checks that no init functions are present in Go code
- goconst # Finds repeated strings that could be replaced by a constant.
- godox # Checks for FIXME, TODO, etc. comments.
# - goerr113 # Go linter to check the errors handling expressions.
- gofmt # Checks whether code was gofmt-ed.
- gofumpt # Checks whether code was gofumpt-ed.
- goimports # Checks that import statements are sorted (and optionally grouped) properly.
- goprintffuncname # Checks that printf-like functions are named with f at the end.
- gosec # Inspects source code for security problems.
- gosimple # Specializes in simplifying code.
- govet # Reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.
- ineffassign # Detects when assignments to existing variables are not used.
- makezero # Finds slice declarations with non-zero initial length
- misspell # Finds commonly misspelled English words in comments
- musttag # Enforce field tags in (un)marshaled structs
- nakedret # Finds naked returns in functions greater than a specified function length.
- nilerr # Finds the code that returns nil even if it checks that the error is not nil.
- nilnil # Checks that there is no simultaneous return of nil error and an invalid value.
- noctx # Finds sending http request without context.Context.
- nolintlint # Reports ill-formed or insufficient nolint directives.
- prealloc # Finds slice declarations that could potentially be pre-allocated. Simplest optimisation.
- predeclared # Find code that shadows one of Go's predeclared identifiers
- reassign # Checks that package variables are not reassigned
- revive # Drop-in replacement for golint; used by Codacy.
- rowserrcheck # Checks whether Err of rows is checked successfully
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
- staticcheck # Set of static checks, see https://staticcheck.io/docs/checks/.
- stylecheck # Stylecheck is a replacement for golint
- tenv # Detects using os.Setenv instead of t.Setenv since Go1.17
- thelper # thelper detects Go test helpers without t.Helper() call and checks the consistency of test helpers
- tparallel # Detects inappropriate usage of t.Parallel() method in your Go test codes
- typecheck # Parses and type-checks Go code.
- unconvert # Remove unnecessary type conversions.
- unparam # Reports unused function parameters.
- unused # Checks code for unused constants, variables, functions and types.
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library.
- varnamelen # Checks that the length of a variable's name matches its scope.
- wastedassign # Finds wasted assignment statements.
- whitespace # Detects leading and trailing whitespace.
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/amanbolat/zederr)
goconst:
min-len: 2
min-occurrences: 2
settings:
hugeParam:
sizeThreshold: 180 # default: 80
goimports:
local-prefixes: github.com/amanbolat/zederr
misspell:
locale: US
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint to be specific what to skip
varnamelen:
ignore-type-assert-ok: true # name var `ok` to check type assertion success
ignore-map-index-ok: true # name var `ok` to check map read by key operation success
ignore-chan-recv-ok: true # name var `ok` to check if channel is closed
ignore-names:
- i # typical name for loop var
errcheck:
check-type-assertions: true
check-blank: true