88# outputs it results from the linters it executes.
99output :
1010 # 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
1213
1314 # print lines of code with issue, default is true
1415 print-issued-lines : true
1516
1617 # print linter name in the end of issue text, default is true
1718 print-linter-name : true
1819
19- # make issues output unique by line, default is true
20- uniq-by-line : true
21-
2220# This section provides the configuration for each linter
2321# we've instructed golangci to execute.
2422linters-settings :
23+ # https://github.com/karamaru-alpha/copyloopvar
24+ copyloopvar :
25+ check-alias : true
26+
2527 # https://github.com/mibk/dupl
2628 dupl :
2729 threshold : 100
@@ -32,6 +34,18 @@ linters-settings:
3234 lines : 160
3335 statements : 70
3436
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+
3549 # https://github.com/denis-tingaikin/go-header
3650 goheader :
3751 template : |-
@@ -42,10 +56,10 @@ linters-settings:
4256 locale : US
4357
4458 # https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint
45- 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
59+ nolintlint :
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
4963
5064# This section provides the configuration for which linters
5165# golangci will execute. Several of them were disabled by
@@ -56,46 +70,43 @@ linters:
5670
5771 # enable a specific set of linters to run
5872 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 # consistent import ordering
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+ - gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod
88+ - goprintffuncname # checks that printf-like functions are named with f at the end
89+ - gosec # inspects code for security problems
90+ - gosimple # linter that specializes in simplifying a code
91+ - govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string
92+ - ineffassign # detects when assignments to existing variables aren't used
93+ - makezero # finds slice declarations with non-zero initial length
94+ - misspell # finds commonly misspelled English words in comments
95+ - nakedret # finds naked returns in functions greater than a specified function length
96+ - nilerr # finds the code that returns nil even if it checks that the error is not nil
97+ - noctx # noctx finds sending http request without context.Context
98+ - nolintlint # reports ill-formed or insufficient nolint directives
99+ - revive # linter for go
100+ - staticcheck # applies static analysis checks, go vet on steroids
101+ - stylecheck # replacement for golint
102+ - typecheck # parses and type-checks go code, like the front-end of a go compiler
103+ - unconvert # remove unnecessary type conversions
104+ - unparam # reports unused function parameters
105+ - unused # checks for unused constants, variables, functions and types
106+ - usetesting # checks to make sure to use testing specific helpers
107+ - whitespace # detects leading and trailing whitespace
108+ - wsl # forces code to use empty lines
109+
99110 # static list of linters we know golangci can run but we've
100111 # chosen to leave disabled for now
101112 # - asciicheck - non-critical
@@ -108,21 +119,21 @@ linters:
108119 # - exhaustivestruct - style preference
109120 # - forbidigo - unused
110121 # - forcetypeassert - unused
111- # - gci - use goimports
112122 # - gochecknoinits - unused
113123 # - gochecknoglobals - global variables allowed
114- # - gocognit - unused complexity metric
124+ # - gocognit - unused complexity metric
115125 # - gocritic - style preference
116126 # - godox - to be used in the future
117127 # - goerr113 - to be used in the future
128+ # - goimports - use gci
118129 # - golint - archived, replaced with revive
119130 # - gofumpt - use gofmt
120131 # - gomnd - get too many false-positives
121132 # - gomodguard - unused
122133 # - ifshort - use both styles
123134 # - ireturn - allow interfaces to be returned
124135 # - importas - want flexibility with naming
125- # - lll - not too concerned about line length
136+ # - lll - not too concerned about line length
126137 # - interfacer - archived
127138 # - nestif - non-critical
128139 # - nilnil - style preference
@@ -131,7 +142,7 @@ linters:
131142 # - paralleltest - false-positives
132143 # - prealloc - don't use
133144 # - predeclared - unused
134- # - promlinter - style preference
145+ # - promlinter - style preference
135146 # - rowserrcheck - unused
136147 # - scopelint - deprecated - replaced with exportloopref
137148 # - sqlclosecheck - unused
@@ -145,6 +156,8 @@ linters:
145156# This section provides the configuration for how golangci
146157# will report the issues it finds.
147158issues :
159+ # make issues output unique by line, default is true
160+ uniq-by-line : true
148161 # Excluding configuration per-path, per-linter, per-text and per-source
149162 exclude-rules :
150163 # prevent linters from running on *_test.go files
@@ -154,3 +167,4 @@ issues:
154167 - funlen
155168 - goconst
156169 - gocyclo
170+ - wsl
0 commit comments