Skip to content

Commit 2a58802

Browse files
committed
migrate yaml config too
1 parent 5a93755 commit 2a58802

File tree

1 file changed

+92
-163
lines changed

1 file changed

+92
-163
lines changed

.golangci.yml

Lines changed: 92 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,98 @@
1-
# This is a manually created golangci.com yaml configuration with
2-
# some defaults explicitly provided. There is a large number of
3-
# linters we've enabled that are usually disabled by default.
4-
#
5-
# https://golangci-lint.run/usage/configuration/#config-file
6-
7-
# This section provides the configuration for how golangci
8-
# outputs it results from the linters it executes.
1+
version: "2"
92
output:
10-
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
113
formats:
12-
- format: colored-line-number
13-
14-
# print lines of code with issue, default is true
15-
print-issued-lines: true
16-
17-
# print linter name in the end of issue text, default is true
18-
print-linter-name: true
19-
20-
# This section provides the configuration for which linters
21-
# golangci will execute. Several of them were disabled by
22-
# default but we've opted to enable them.
23-
#
24-
# see https://golangci-lint.run/usage/linters/
4+
text:
5+
path: stdout
6+
print-linter-name: true
7+
print-issued-lines: true
258
linters:
26-
disable-all: true
9+
default: none
2710
enable:
28-
- bidichk # checks for dangerous unicode character sequences
29-
- bodyclose # checks whether HTTP response body is closed successfully
30-
- contextcheck # check the function whether use a non-inherited context
31-
- copyloopvar # detects places where loop variables are copied
32-
- dupl # code clone detection
33-
- errcheck # checks for unchecked errors
34-
- errorlint # find misuses of errors
35-
- funlen # detects long functions
36-
- gci # consistent import order
37-
- goconst # finds repeated strings that could be replaced by a constant
38-
- gocyclo # computes and checks the cyclomatic complexity of functions
39-
- godot # checks if comments end in a period
40-
- gofmt # checks whether code was gofmt-ed
41-
- goheader # checks is file header matches to pattern
42-
- gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod
43-
- goprintffuncname # checks that printf-like functions are named with f at the end
44-
- gosec # inspects code for security problems
45-
- gosimple # linter that specializes in simplifying a code
46-
- govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string
47-
- ineffassign # detects when assignments to existing variables aren't used
48-
- makezero # finds slice declarations with non-zero initial length
49-
- misspell # finds commonly misspelled English words in comments
50-
- nakedret # finds naked returns in functions greater than a specified function length
51-
- nilerr # finds the code that returns nil even if it checks that the error is not nil
52-
- noctx # noctx finds sending http request without context.Context
53-
- nolintlint # reports ill-formed or insufficient nolint directives
54-
- revive # linter for go
55-
- staticcheck # applies static analysis checks, go vet on steroids
56-
- stylecheck # replacement for golint
57-
- tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
58-
- typecheck # parses and type-checks go code, like the front-end of a go compiler
59-
- unconvert # remove unnecessary type conversions
60-
- unparam # reports unused function parameters
61-
- unused # checks for unused constants, variables, functions and types
62-
- whitespace # detects leading and trailing whitespace
63-
- wsl # forces code to use empty lines
64-
65-
# static list of linters we know golangci can run but we've
66-
# chosen to leave disabled for now
67-
# - asciicheck - non-critical
68-
# - cyclop - unused complexity metric
69-
# - deadcode - finds unused code (deprecated)
70-
# - depguard - unused
71-
# - dogsled - blanks allowed
72-
# - durationcheck - unused
73-
# - errname - unused
74-
# - exhaustive - unused
75-
# - exhaustivestruct - style preference
76-
# - exportloopref - check for exported loop vars
77-
# - forbidigo - unused
78-
# - forcetypeassert - unused
79-
# - gochecknoinits - unused
80-
# - gochecknoglobals - global variables allowed
81-
# - gocognit - unused complexity metric
82-
# - gocritic - style preference
83-
# - godox - to be used in the future
84-
# - goerr113 - to be used in the future
85-
# - goimports - use gci instead
86-
# - golint - archived, replaced with revive
87-
# - gofumpt - use gofmt
88-
# - gomnd - get too many false-positives
89-
# - gomodguard - unused
90-
# - ifshort - use both styles
91-
# - ireturn - allow interfaces to be returned
92-
# - importas - want flexibility with naming
93-
# - lll - not too concerned about line length
94-
# - interfacer - archived
95-
# - nestif - non-critical
96-
# - nilnil - style preference
97-
# - nlreturn - style preference
98-
# - maligned - archived, replaced with govet 'fieldalignment'
99-
# - paralleltest - false-positives
100-
# - prealloc - don't use
101-
# - predeclared - unused
102-
# - promlinter - style preference
103-
# - rowserrcheck - unused
104-
# - scopelint - deprecated - replaced with exportloopref
105-
# - sqlclosecheck - unused
106-
# - structcheck - finds unused struct fields (deprecated)
107-
# - tagliatelle - use a mix of variable naming
108-
# - testpackage - don't use this style of testing
109-
# - thelper - false-positives
110-
# - varcheck - finds unused global variables and constants (deprecated)
111-
# - varnamelen - unused
112-
# - wastedassign - duplicate functionality
113-
# - wrapcheck - style preference
114-
115-
# This section provides the configuration for each linter
116-
# we've instructed golangci to execute.
117-
linters-settings:
118-
# https://github.com/fzipp/gocyclo
119-
gocyclo:
120-
min-complexity: 18
121-
122-
# https://github.com/ultraware/funlen
123-
funlen:
124-
# accounting for comments
125-
lines: 160
126-
statements: 70
127-
128-
# https://github.com/daixiang0/gci
129-
# gci write --skip-generated -s standard -s default -s prefix(github.com/target/flottbot)
130-
gci:
131-
sections:
132-
- standard
133-
- default
134-
- prefix(github.com/target/flottbot)
135-
136-
# https://github.com/client9/misspell
137-
misspell:
138-
locale: US
139-
140-
# https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint
141-
nolintlint:
142-
allow-unused: false # allow nolint directives that don't address a linting issue
143-
require-explanation: true # require an explanation for nolint directives
144-
require-specific: true # require nolint directives to be specific about which linter is being skipped
145-
146-
# https://github.com/denis-tingaikin/go-header
147-
goheader:
148-
template: |-
149-
SPDX-License-Identifier: Apache-2.0
150-
151-
# This section provides the configuration for how golangci
152-
# will report the issues it finds.
11+
- bidichk
12+
- bodyclose
13+
- contextcheck
14+
- copyloopvar
15+
- dupl
16+
- errcheck
17+
- errorlint
18+
- funlen
19+
- goconst
20+
- gocyclo
21+
- godot
22+
- goheader
23+
- gomoddirectives
24+
- goprintffuncname
25+
- gosec
26+
- govet
27+
- ineffassign
28+
- makezero
29+
- misspell
30+
- nakedret
31+
- nilerr
32+
- noctx
33+
- nolintlint
34+
- revive
35+
- staticcheck
36+
- unconvert
37+
- unparam
38+
- unused
39+
- whitespace
40+
- wsl
41+
settings:
42+
funlen:
43+
lines: 160
44+
statements: 70
45+
gocyclo:
46+
min-complexity: 18
47+
goheader:
48+
template: 'SPDX-License-Identifier: Apache-2.0'
49+
misspell:
50+
locale: US
51+
nolintlint:
52+
require-explanation: true
53+
require-specific: true
54+
allow-unused: false
55+
exclusions:
56+
generated: lax
57+
presets:
58+
- comments
59+
- common-false-positives
60+
- legacy
61+
- std-error-handling
62+
rules:
63+
- linters:
64+
- dupl
65+
- funlen
66+
- goconst
67+
- gocyclo
68+
path: _test\.go
69+
paths:
70+
- testdata
71+
- helm
72+
- config-example
73+
- config
74+
- third_party$
75+
- builtin$
76+
- examples$
15377
issues:
154-
# make issues output unique by line, default is true
15578
uniq-by-line: true
156-
# Excluding configuration per-path, per-linter, per-text and per-source
157-
exclude-rules:
158-
# prevent linters from running on *_test.go files
159-
- path: _test\.go
160-
linters:
161-
- dupl
162-
- funlen
163-
- goconst
164-
- gocyclo
165-
exclude-dirs:
166-
- testdata
167-
- helm
168-
- config-example
169-
- config
79+
formatters:
80+
enable:
81+
- gci
82+
- gofmt
83+
settings:
84+
gci:
85+
sections:
86+
- standard
87+
- default
88+
- prefix(github.com/target/flottbot)
89+
exclusions:
90+
generated: lax
91+
paths:
92+
- testdata
93+
- helm
94+
- config-example
95+
- config
96+
- third_party$
97+
- builtin$
98+
- examples$

0 commit comments

Comments
 (0)