-
Notifications
You must be signed in to change notification settings - Fork 16
/
.golangci.yaml
150 lines (124 loc) · 3.97 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
---
# Options for analysis running.
run:
timeout: 5m
tests: true
linters:
enable:
# check when errors are compared without errors.Is
- errorlint
# check imports order and makes it always deterministic.
- gci
# linter to detect errors invalid key values count
- loggercheck
# simple security check
- gosec
# Fast, configurable, extensible, flexible, and beautiful linter for Go.
# Drop-in replacement of golint.
- revive
# make sure to use t.Helper() when needed
- thelper
# make sure that error are checked after a rows.Next()
- rowserrcheck
# Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed.
- sqlclosecheck
# ensure that lint exceptions have explanations. Consider the case below:
- nolintlint
# detect duplicated words in code
- dupword
# detect the possibility to use variables/constants from the Go standard library.
- usestdlibvars
# mirror suggests rewrites to avoid unnecessary []byte/string conversion
- mirror
# testify checks good usage of github.com/stretchr/testify.
- testifylint
# Check whether the function uses a non-inherited context.
- contextcheck
linters-settings:
loggercheck:
require-string-key: true
# Require printf-like format specifier (%s, %d for example) not present.
# Default: false
no-printf-like: true
nolintlint:
# Disable to ensure that all nolint directives actually have an effect.
# Default: false
allow-unused: true
# Enable to require an explanation of nonzero length
# after each nolint directive.
# Default: false
require-explanation: true
# Enable to require nolint directives to mention the specific
# linter being suppressed.
# Default: false
require-specific: true
gci:
sections:
- standard
- default
- prefix(syscall/js) # fixme: workaround, wait for https://github.com/daixiang0/gci/pull/208 merged
- localmodule
custom-order: true
staticcheck:
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
checks: [ "all" ]
revive:
enable-all-rules: true
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported
- name: exported
arguments:
# enables checking public methods of private types
- "checkPrivateReceivers"
# make error messages clearer
- "sayRepetitiveInsteadOfStutters"
- name: unhandled-error
arguments: # here are the exceptions we don't want to be reported
- "fmt.Print.*"
- "fmt.Fprint.*"
- "bytes.Buffer.Write"
- "bytes.Buffer.WriteByte"
- "bytes.Buffer.WriteString"
- "strings.Builder.WriteString"
- "strings.Builder.WriteRune"
- name: cognitive-complexity
severity: warning
arguments: [ 300 ]
- name: cyclomatic
arguments: [ 100 ]
- name: struct-tag
disabled: true
- name: add-constant
disabled: true
- name: flag-parameter
disabled: true
- name: imports-blocklist
disabled: true
- name: nested-structs
disabled: true
- name: modifies-value-receiver
disabled: true
- name: line-length-limit
disabled: true
- name: argument-limit
disabled: true
- name: banned-characters
disabled: true
- name: max-public-structs
disabled: true
- name: function-result-limit
disabled: true
- name: function-length
disabled: true
- name: file-header
disabled: true
- name: empty-lines
disabled: true
misspell:
locale: "US" # Fix the colour => color, and co
output:
# Make issues output unique by line.
# Default: true
# Note: unique in this case means that you can have at most 1 issue per line of code.
# one issue with a given line and we want to see them all at once.
uniq-by-line: false