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 : json
13
+ path : stderr
14
+ - format : colored-line-number
12
15
13
16
# print lines of code with issue, default is true
14
17
print-issued-lines : true
@@ -32,6 +35,18 @@ linters-settings:
32
35
lines : 160
33
36
statements : 70
34
37
38
+ # https://github.com/daixiang0/gci
39
+ # ensure import order is consistent
40
+ # gci write --custom-order -s standard -s default -s blank -s dot -s "prefix(github.com/go-vela)" .
41
+ gci :
42
+ custom-order : true
43
+ sections :
44
+ - standard
45
+ - default
46
+ - blank
47
+ - dot
48
+ - prefix(github.com/go-vela)
49
+
35
50
# https://github.com/denis-tingaikin/go-header
36
51
goheader :
37
52
template : |-
@@ -43,9 +58,9 @@ linters-settings:
43
58
44
59
# https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint
45
60
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
61
+ allow-unused : false # allow nolint directives that don't address a linting issue
62
+ require-explanation : true # require an explanation for nolint directives
63
+ require-specific : true # require nolint directives to be specific about which linter is being skipped
49
64
50
65
# This section provides the configuration for which linters
51
66
# golangci will execute. Several of them were disabled by
@@ -56,46 +71,43 @@ linters:
56
71
57
72
# enable a specific set of linters to run
58
73
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
-
74
+ - bidichk # checks for dangerous unicode character sequences
75
+ - bodyclose # checks whether HTTP response body is closed successfully
76
+ - contextcheck # check the function whether use a non-inherited context
77
+ - dupl # code clone detection
78
+ - errcheck # checks for unchecked errors
79
+ - errorlint # find misuses of errors
80
+ - exportloopref # check for exported loop vars
81
+ - funlen # detects long functions
82
+ - gci # consistent import ordering
83
+ - goconst # finds repeated strings that could be replaced by a constant
84
+ - gocyclo # computes and checks the cyclomatic complexity of functions
85
+ - godot # checks if comments end in a period
86
+ - gofmt # checks whether code was gofmt-ed
87
+ - goheader # checks is file header matches to pattern
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
+ - tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
104
+ - typecheck # parses and type-checks go code, like the front-end of a go compiler
105
+ - unconvert # remove unnecessary type conversions
106
+ - unparam # reports unused function parameters
107
+ - unused # checks for unused constants, variables, functions and types
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
@@ -108,21 +120,21 @@ linters:
108
120
# - exhaustivestruct - style preference
109
121
# - forbidigo - unused
110
122
# - forcetypeassert - unused
111
- # - gci - use goimports
112
123
# - gochecknoinits - unused
113
124
# - gochecknoglobals - global variables allowed
114
- # - gocognit - unused complexity metric
125
+ # - gocognit - unused complexity metric
115
126
# - gocritic - style preference
116
127
# - godox - to be used in the future
117
128
# - goerr113 - to be used in the future
129
+ # - goimports - use gci
118
130
# - golint - archived, replaced with revive
119
131
# - gofumpt - use gofmt
120
132
# - gomnd - get too many false-positives
121
133
# - gomodguard - unused
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
@@ -154,3 +166,5 @@ issues:
154
166
- funlen
155
167
- goconst
156
168
- gocyclo
169
+ - wsl
170
+
0 commit comments