forked from k0sproject/k0s
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
131 lines (131 loc) · 4.42 KB
/
Copy path.golangci.yml
File metadata and controls
131 lines (131 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
version: "2"
run:
build-tags:
- hack
modules-download-mode: readonly
tests: true
allow-parallel-runners: true
linters:
enable:
- copyloopvar # Detects unnecessary copies of loop variables for Go >= 1.22
- depguard # Checks if package imports are in a list of acceptable packages
- dupword # Finds word repetitions
- errorlint # Find code that will cause problems with Go's error wrapping scheme
- exptostd # Detects functions from golang.org/x/exp/ that can be replaced by std functions
- gocritic # another style/metalinter (dynamic rules supported)
- goheader # Checks is file headers matches a given pattern
- intrange # Checking for loops that could use an integer range
- misspell # Finds commonly misspelled English words
- nilnesserr # Reports constructs that check for err != nil but return a different nil value error
- nolintlint # Find ill-formed or insufficiently explained nolint directives
- nosprintfhostport # Detects misuses of Sprintf to construct hosts with ports in a URL
- perfsprint # Checks for faster fmt.Sprintf alternatives
- revive # Stricter drop-in replacement for golint
- testifylint # Checks usage of github.com/stretchr/testify
- unconvert # Checks for unnecessary type conversions
- unparam # Checks for unused function parameters
- usestdlibvars # Checks for things that are provided by the standard library
- usetesting # Reports usages of functions that have a replacement within the testing package
settings:
depguard:
rules:
cloud-provider:
list-mode: lax
files:
- '!**/pkg/k0scloudprovider/*.go'
deny:
- pkg: k8s.io/cloud-provider
desc: >-
Usages of the k8s cloud provider are only allowed from within the
k0s cloud provider package. This is to ensure that it's not
leaking global flags into k0s.
inttests:
list-mode: lax
files:
- '!**/inttest/**/*'
deny:
- pkg: github.com/k0sproject/k0s/inttest
desc: Usage of integration test code outside of integration tests.
replacements:
list-mode: lax
deny:
- pkg: gopkg.in/yaml.v2
desc: Use sigs.k8s.io/yaml.
- pkg: gopkg.in/yaml.v3
desc: Use sigs.k8s.io/yaml.
- pkg: k8s.io/utils/pointer
desc: Use k8s.io/utils/ptr.
tests:
list-mode: lax
files:
- '!$test'
- '!**/internal/testutil/**'
- '!**/internal/autopilot/testutil/**'
- '!**/inttest/**'
deny:
- pkg: github.com/k0sproject/k0s/internal/testutil
desc: Usage of test code outside of tests.
- pkg: github.com/k0sproject/k0s/internal/autopilot/testutil
desc: Usage of test code outside of tests.
- pkg: github.com/stretchr/testify
desc: Usage of test code outside of tests.
gocritic:
disabled-checks:
- singleCaseSwitch
settings:
ifElseChain:
minThreshold: 5
goheader:
values:
regexp:
year: 202[0-9]
template-path: .go-header.txt
misspell:
locale: US
revive:
rules:
# This forbids to name variables "close", which seems natural for "close" functions.
- name: redefines-builtin-id
disabled: true
testifylint:
enable-all: true
disable:
- require-error # flags too many legitimate use cases
- suite-thelper # flags too many legitimate use cases
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- goheader
source: ^//go:build
- linters:
- staticcheck
text: '^SA1019:'
- linters:
- goheader
path: pkg/component/controller/cplb/tcpproxy/.*
paths:
- zz_*
- build
- docs
- embedded-bins
- examples
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gofmt
exclusions:
generated: lax
paths:
- zz_*
- build
- docs
- embedded-bins
- examples