Skip to content

Commit 278f526

Browse files
committed
add comments
Signed-off-by: dongjiang <[email protected]>
1 parent 365dac7 commit 278f526

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.golangci.yml

+20
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ linters:
6060
no-unaliased: true
6161
revive:
6262
rules:
63+
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
6364
- name: blank-imports
6465
- name: context-as-argument
6566
- name: context-keys-type
@@ -81,6 +82,9 @@ linters:
8182
- name: superfluous-else
8283
- name: unreachable-code
8384
- name: redefines-builtin-id
85+
#
86+
# Rules in addition to the recommended configuration above.
87+
#
8488
- name: bool-literal-in-expr
8589
- name: constant-logical-expr
8690
exclusions:
@@ -98,9 +102,13 @@ linters:
98102
- linters:
99103
- staticcheck
100104
text: 'SA1019: .*The component config package has been deprecated and will be removed in a future release.'
105+
# With Go 1.16, the new embed directive can be used with an un-named import,
106+
# revive (previously, golint) only allows these to be imported in a main.go, which wouldn't work for us.
107+
# This directive allows the embed package to be imported with an underscore everywhere.
101108
- linters:
102109
- revive
103110
source: _ "embed"
111+
# Exclude some packages or code to require comments, for example test code, or fake clients.
104112
- linters:
105113
- revive
106114
text: exported (method|function|type|const) (.+) should have comment or be unexported
@@ -109,21 +117,28 @@ linters:
109117
- revive
110118
path: fake_\.go
111119
text: exported (method|function|type|const) (.+) should have comment or be unexported
120+
# Disable unparam "always receives" which might not be really
121+
# useful when building libraries.
112122
- linters:
113123
- unparam
114124
text: always receives
125+
# Dot imports for gomega and ginkgo are allowed
126+
# within test files.
115127
- path: _test\.go
116128
text: should not use dot imports
117129
- path: _test\.go
118130
text: cyclomatic complexity
119131
- path: _test\.go
120132
text: 'G107: Potential HTTP request made with variable url'
133+
# Append should be able to assign to a different var/slice.
121134
- linters:
122135
- gocritic
123136
text: 'appendAssign: append result not assigned to the same slice'
124137
- linters:
125138
- gocritic
126139
text: 'singleCaseSwitch: should rewrite switch statement to if statement'
140+
# It considers all file access to a filename that comes from a variable problematic,
141+
# which is naiv at best.
127142
- linters:
128143
- gosec
129144
text: 'G304: Potential file inclusion via variable'
@@ -135,7 +150,12 @@ linters:
135150
path: .*/internal/.*
136151
- linters:
137152
- unused
153+
# Seems to incorrectly trigger on the two implementations that are only
154+
# used through an interface and not directly..?
155+
# Likely same issue as https://github.com/dominikh/go-tools/issues/1616
138156
path: pkg/controller/priorityqueue/metrics\.go
157+
# The following are being worked on to remove their exclusion. This list should be reduced or go away all together over time.
158+
# If it is decided they will not be addressed they should be moved above this comment.
139159
- path: (.+)\.go$
140160
text: Subprocess launch(ed with variable|ing should be audited)
141161
- path: (.+)\.go$

0 commit comments

Comments
 (0)