8
8
# outputs it results from the linters it executes.
9
9
output :
10
10
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
11
- format : colored-line-number
11
+ formats :
12
+ - format : colored-line-number
12
13
13
14
# print lines of code with issue, default is true
14
15
print-issued-lines : true
15
16
16
17
# print linter name in the end of issue text, default is true
17
18
print-linter-name : true
18
19
19
- # make issues output unique by line, default is true
20
- uniq-by-line : true
21
-
22
20
# This section provides the configuration for each linter
23
21
# we've instructed golangci to execute.
24
22
linters-settings :
23
+ # https://github.com/karamaru-alpha/copyloopvar
24
+ copyloopvar :
25
+ check-alias : true
26
+
25
27
# https://github.com/mibk/dupl
26
28
dupl :
27
29
threshold : 100
@@ -32,6 +34,18 @@ linters-settings:
32
34
lines : 160
33
35
statements : 70
34
36
37
+ # https://github.com/daixiang0/gci
38
+ # ensure import order is consistent
39
+ # gci write --custom-order -s standard -s default -s blank -s dot -s "prefix(github.com/go-vela)" .
40
+ gci :
41
+ custom-order : true
42
+ sections :
43
+ - standard
44
+ - default
45
+ - blank
46
+ - dot
47
+ - prefix(github.com/go-vela)
48
+
35
49
# https://github.com/denis-tingaikin/go-header
36
50
goheader :
37
51
template : |-
@@ -43,9 +57,9 @@ linters-settings:
43
57
44
58
# https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint
45
59
nolintlint :
46
- allow-unused : false # allow nolint directives that don't address a linting issue
47
- require-explanation : true # require an explanation for nolint directives
48
- require-specific : true # require nolint directives to be specific about which linter is being skipped
60
+ allow-unused : false # allow nolint directives that don't address a linting issue
61
+ require-explanation : true # require an explanation for nolint directives
62
+ require-specific : true # require nolint directives to be specific about which linter is being skipped
49
63
50
64
# This section provides the configuration for which linters
51
65
# golangci will execute. Several of them were disabled by
@@ -56,46 +70,44 @@ linters:
56
70
57
71
# enable a specific set of linters to run
58
72
enable :
59
- - bidichk # checks for dangerous unicode character sequences
60
- - bodyclose # checks whether HTTP response body is closed successfully
61
- - contextcheck # check the function whether use a non-inherited context
62
- - deadcode # finds unused code
63
- - dupl # code clone detection
64
- - errcheck # checks for unchecked errors
65
- - errorlint # find misuses of errors
66
- - exportloopref # check for exported loop vars
67
- - funlen # detects long functions
68
- - goconst # finds repeated strings that could be replaced by a constant
69
- - gocyclo # computes and checks the cyclomatic complexity of functions
70
- - godot # checks if comments end in a period
71
- - gofmt # checks whether code was gofmt-ed
72
- - goheader # checks is file header matches to pattern
73
- - goimports # fixes imports and formats code in same style as gofmt
74
- - gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod
75
- - goprintffuncname # checks that printf-like functions are named with f at the end
76
- - gosec # inspects code for security problems
77
- - gosimple # linter that specializes in simplifying a code
78
- - govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string
79
- - ineffassign # detects when assignments to existing variables aren't used
80
- - makezero # finds slice declarations with non-zero initial length
81
- - misspell # finds commonly misspelled English words in comments
82
- - nakedret # finds naked returns in functions greater than a specified function length
83
- - nilerr # finds the code that returns nil even if it checks that the error is not nil
84
- - noctx # noctx finds sending http request without context.Context
85
- - nolintlint # reports ill-formed or insufficient nolint directives
86
- - revive # linter for go
87
- - staticcheck # applies static analysis checks, go vet on steroids
88
- - structcheck # finds unused struct fields
89
- - stylecheck # replacement for golint
90
- - tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
91
- - typecheck # parses and type-checks go code, like the front-end of a go compiler
92
- - unconvert # remove unnecessary type conversions
93
- - unparam # reports unused function parameters
94
- - unused # checks for unused constants, variables, functions and types
95
- - varcheck # finds unused global variables and constants
96
- - whitespace # detects leading and trailing whitespace
97
- - wsl # forces code to use empty lines
98
-
73
+ - bidichk # checks for dangerous unicode character sequences
74
+ - bodyclose # checks whether HTTP response body is closed successfully
75
+ - contextcheck # check the function whether use a non-inherited context
76
+ - copyloopvar # detects places where loop variables are copied
77
+ - dupl # code clone detection
78
+ - errcheck # checks for unchecked errors
79
+ - errorlint # find misuses of errors
80
+ - funlen # detects long functions
81
+ - gci # use goimports
82
+ - goconst # finds repeated strings that could be replaced by a constant
83
+ - gocyclo # computes and checks the cyclomatic complexity of functions
84
+ - godot # checks if comments end in a period
85
+ - gofmt # checks whether code was gofmt-ed
86
+ - goheader # checks is file header matches to pattern
87
+ - goimports # fixes imports and formats code in same style as gofmt
88
+ - gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod
89
+ - goprintffuncname # checks that printf-like functions are named with f at the end
90
+ - gosec # inspects code for security problems
91
+ - gosimple # linter that specializes in simplifying a code
92
+ - govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string
93
+ - ineffassign # detects when assignments to existing variables aren't used
94
+ - makezero # finds slice declarations with non-zero initial length
95
+ - misspell # finds commonly misspelled English words in comments
96
+ - nakedret # finds naked returns in functions greater than a specified function length
97
+ - nilerr # finds the code that returns nil even if it checks that the error is not nil
98
+ - noctx # noctx finds sending http request without context.Context
99
+ - nolintlint # reports ill-formed or insufficient nolint directives
100
+ - revive # linter for go
101
+ - staticcheck # applies static analysis checks, go vet on steroids
102
+ - stylecheck # replacement for golint
103
+ - typecheck # parses and type-checks go code, like the front-end of a go compiler
104
+ - unconvert # remove unnecessary type conversions
105
+ - unparam # reports unused function parameters
106
+ - unused # checks for unused constants, variables, functions and types
107
+ - usetesting # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
108
+ - whitespace # detects leading and trailing whitespace
109
+ - wsl # forces code to use empty lines
110
+
99
111
# static list of linters we know golangci can run but we've
100
112
# chosen to leave disabled for now
101
113
# - asciicheck - non-critical
@@ -106,12 +118,12 @@ linters:
106
118
# - errname - unused
107
119
# - exhaustive - unused
108
120
# - exhaustivestruct - style preference
121
+ # - exportloopref - check for exported loop vars
109
122
# - forbidigo - unused
110
123
# - forcetypeassert - unused
111
- # - gci - use goimports
112
124
# - gochecknoinits - unused
113
125
# - gochecknoglobals - global variables allowed
114
- # - gocognit - unused complexity metric
126
+ # - gocognit - unused complexity metric
115
127
# - gocritic - style preference
116
128
# - godox - to be used in the future
117
129
# - goerr113 - to be used in the future
@@ -122,7 +134,7 @@ linters:
122
134
# - ifshort - use both styles
123
135
# - ireturn - allow interfaces to be returned
124
136
# - importas - want flexibility with naming
125
- # - lll - not too concerned about line length
137
+ # - lll - not too concerned about line length
126
138
# - interfacer - archived
127
139
# - nestif - non-critical
128
140
# - nilnil - style preference
@@ -131,7 +143,7 @@ linters:
131
143
# - paralleltest - false-positives
132
144
# - prealloc - don't use
133
145
# - predeclared - unused
134
- # - promlinter - style preference
146
+ # - promlinter - style preference
135
147
# - rowserrcheck - unused
136
148
# - scopelint - deprecated - replaced with exportloopref
137
149
# - sqlclosecheck - unused
@@ -145,6 +157,8 @@ linters:
145
157
# This section provides the configuration for how golangci
146
158
# will report the issues it finds.
147
159
issues :
160
+ # make issues output unique by line, default is true
161
+ uniq-by-line : true
148
162
# Excluding configuration per-path, per-linter, per-text and per-source
149
163
exclude-rules :
150
164
# prevent linters from running on *_test.go files
@@ -154,3 +168,4 @@ issues:
154
168
- funlen
155
169
- goconst
156
170
- gocyclo
171
+
0 commit comments