1- run :
2- # default concurrency is a available CPU number
3- concurrency : 4
4- # timeout for analysis, e.g. 30s, 5m, default is 1m
5- deadline : 20m
6- # exit code when at least one issue was found, default is 1
7- issues-exit-code : 1
8- # include test files or not, default is true
9- tests : false
10-
11- skip-files :
1+ issues :
2+ exclude-dirs-use-default : true
3+ uniq-by-line : true
4+ exclude-files :
125 - " .*\\ .pb\\ .go$"
136 - " .*\\ .gen\\ .go$"
147 - " .*\\ _gen\\ .go$"
158 - " mock_.*\\ .go"
169 - " .*\\ .resolvers\\ .go$"
1710
18- # default is true. Enables skipping of directories:
19- # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
20- skip-dirs-use-default : true
21-
22- # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
23- # If invoked with -mod=readonly, the go command is disallowed from the implicit
24- # automatic updating of go.mod described above. Instead, it fails when any changes
25- # to go.mod are needed. This setting is most useful to check that go.mod does
26- # not need updates, such as in a continuous integration and testing system.
27- # If invoked with -mod=vendor, the go command assumes that the vendor
28- # directory holds the correct copies of dependencies and ignores
29- # the dependency descriptions in go.mod.
11+ run :
12+ concurrency : 4
13+ timeout : 20m
14+ issues-exit-code : 1
15+ tests : false
3016 modules-download-mode : readonly
31-
32- # Allow multiple parallel golangci-lint instances running.
33- # If false (default) - golangci-lint acquires file lock on start.
3417 allow-parallel-runners : false
3518
3619# output configuration options
3720output :
38- # colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
39- # default is "colored-line-number"
40- format : colored-line-number
41-
42- # print lines of code with issue, default is true
4321 print-issued-lines : true
44-
45- # print linter name in the end of issue text, default is true
4622 print-linter-name : true
23+ sort-results : true
24+ sort-order :
25+ - linter
26+ - severity
27+ - file
28+ show-stats : true
4729
48- # make issues output unique by line, default is true
49- uniq-by-line : true
50-
51- # add a prefix to the output file references; default is no prefix
52- path-prefix : " "
53-
54- # sorts results by: filepath, line and column
55- sort-results : false
30+ linters :
31+ enable :
32+ - bodyclose
33+ - depguard
34+ - dogsled
35+ - errcheck
36+ - errorlint
37+ - exhaustive
38+ - forbidigo
39+ - funlen
40+ - goconst
41+ - gocritic
42+ - gocyclo
43+ - gofmt
44+ - goheader
45+ - goimports
46+ - goprintffuncname
47+ - gosec
48+ - gosimple
49+ - govet
50+ - ineffassign
51+ - misspell
52+ - nakedret
53+ - noctx
54+ - nolintlint
55+ - rowserrcheck
56+ - revive
57+ - staticcheck
58+ - stylecheck
59+ - typecheck
60+ - unconvert
61+ - unparam
62+ - unused
63+ - whitespace
5664
5765linters-settings :
5866 dogsled :
59- # checks assignments with too many blank identifiers; default is 2
6067 max-blank-identifiers : 2
6168 dupl :
62- # tokens count to trigger issue, 150 by default
6369 threshold : 150
70+ depguard :
71+ rules :
72+ main :
73+ allow :
74+ - $gostd
75+ - github.com/elastic/harp-plugins/terraformer
76+ - github.com/elastic/harp/
77+ - github.com/elastic/harp/build/version
78+ - github.com/elastic/harp/pkg/cso/v1
79+ - github.com/elastic/harp/pkg/sdk/cmdutil
80+ - github.com/elastic/harp/pkg/sdk/config
81+ - github.com/elastic/harp/pkg/sdk/config/cmd
82+ - github.com/elastic/harp/pkg/sdk/log
83+ - github.com/elastic/harp/pkg/sdk/platform
84+ - github.com/elastic/harp/pkg/sdk/types
85+ - github.com/elastic/harp/pkg/template/engine
86+ - github.com/elastic/harp/pkg/vault/path
87+ - github.com/go-ozzo/ozzo-validation
88+ - github.com/gosimple/slug
89+ - github.com/hashicorp/hcl
90+ - github.com/spf13/cobra
91+ - go.uber.org/zap
92+ - google.golang.org/protobuf
93+ - gopkg.in/yaml.v2
6494 errcheck :
65- # report about not checking of errors in type assertions: `a := b.(MyStruct)`;
66- # default is false: such cases aren't reported by default.
6795 check-type-assertions : false
68-
69- # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
70- # default is false: such cases aren't reported by default.
7196 check-blank : false
72-
73- # [deprecated] comma-separated list of pairs of the form pkg:regex
74- # the regex is used to ignore names within pkg. (default "fmt:.*").
75- # see https://github.com/kisielk/errcheck#the-deprecated-method for details
76- ignore : fmt:.*,io/ioutil:^Read.*
97+ exclude-functions :
98+ - fmt:.*
99+ - io/ioutil:^Read.*
77100 exhaustive :
78- # check switch statements in generated files also
79101 check-generated : false
80- # indicates that switch statements are to be considered exhaustive if a
81- # 'default' case is present, even if all enum members aren't listed in the
82- # switch
83102 default-signifies-exhaustive : false
84- govet :
85- # report about shadowed variables
86- check-shadowing : true
87103 goimports :
88104 local : " github.com/elastic"
89105 golint :
@@ -98,51 +114,29 @@ linters-settings:
98114 line-length : 140
99115 tab-width : 1
100116 gci :
101- # put imports beginning with prefix after 3rd-party packages;
102- # only support one prefix
103- # if not set, use goimports.local-prefixes
104- local-prefixes : github.com/elastic
117+ sections :
118+ - prefix(github.com/elastic)
105119 gocognit :
106- # minimal code complexity to report, 30 by default (but we recommend 10-20)
107120 min-complexity : 20
108121 goconst :
109- # minimal length of string constant, 3 by default
110122 min-len : 3
111- # minimal occurrences count to trigger, 3 by default
112123 min-occurrences : 3
113124 nestif :
114- # minimal complexity of if statements to report, 5 by default
115125 min-complexity : 4
116126 gomnd :
117127 settings :
118128 mnd :
119- # don't include the "operation" and "assign"
120129 checks : argument,case,condition,return
121130 unused :
122- # treat code as a program (not a library) and report unused exported identifiers; default is false.
123- # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
124- # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
125- # with golangci-lint call it on a directory with the changed file.
126131 check-exported : false
127132 unparam :
128- # call graph construction algorithm (cha, rta). In general, use cha for libraries,
129- # and rta for programs with main packages. Default is cha.
130- algo : cha
131-
132- # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
133- # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
134- # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
135- # with golangci-lint call it on a directory with the changed file.
136133 check-exported : false
137134 nakedret :
138- # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
139135 max-func-lines : 30
140136 prealloc :
141- # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
142- # True by default.
143137 simple : true
144- range-loops : true # Report preallocation suggestions on range loops, true by default
145- for-loops : false # Report preallocation suggestions on for loops, false by default
138+ range-loops : true
139+ for-loops : false
146140 funlen :
147141 lines : 100
148142 statements : 50
@@ -171,54 +165,9 @@ linters-settings:
171165 specific language governing permissions and limitations
172166 under the License.
173167 gocritic :
174- # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
175- # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
176168 enabled-tags :
177169 - diagnostic
178170 - performance
179171 - style
180- - opinionated
181172 - experimental
182-
183- linters :
184- enable :
185- - bodyclose
186- - deadcode
187- - depguard
188- - dogsled
189- # - dupl
190- - errcheck
191- - errorlint
192- - exportloopref
193- - exhaustive
194- - forbidigo
195- - funlen
196- # - gochecknoinits
197- - goconst
198- - gocritic
199- - gocyclo
200- - gofmt
201- - goheader
202- - goimports
203- # - gomnd
204- - goprintffuncname
205- - gosec
206- - gosimple
207- - govet
208- - ineffassign
209- # - lll
210- - misspell
211- - nakedret
212- - noctx
213- - nolintlint
214- - rowserrcheck
215- - revive
216- - staticcheck
217- - structcheck
218- - stylecheck
219- - typecheck
220- - unconvert
221- - unparam
222- - unused
223- - varcheck
224- - whitespace
173+ - opinionated
0 commit comments