Skip to content

Commit ea50bae

Browse files
authored
Merge pull request kubernetes#129875 from pohly/golangci-lint-strict-removal
golangci-lint: remove "strict" checking
2 parents 215a910 + 9493857 commit ea50bae

File tree

6 files changed

+7
-299
lines changed

6 files changed

+7
-299
lines changed

hack/golangci-hints.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# enable an increasing amount of checks:
33
# - golangci.yaml is the most permissive configuration. All existing code
44
# passed.
5-
# - golangci-strict.yaml adds checks that all new code in pull requests
6-
# must pass.
75
# - golangci-hints.yaml adds checks for code patterns where developer
86
# and reviewer may decide whether findings should get addressed before
97
# merging. Beware that the golangci-lint output includes also the

hack/golangci-strict.yaml

Lines changed: 0 additions & 269 deletions
This file was deleted.

hack/golangci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# enable an increasing amount of checks:
33
# - golangci.yaml is the most permissive configuration. All existing code
44
# passed.
5-
# - golangci-strict.yaml adds checks that all new code in pull requests
6-
# must pass.
75
# - golangci-hints.yaml adds checks for code patterns where developer
86
# and reviewer may decide whether findings should get addressed before
97
# merging. Beware that the golangci-lint output includes also the

hack/golangci.yaml.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# enable an increasing amount of checks:
33
# - golangci.yaml is the most permissive configuration. All existing code
44
# passed.
5-
# - golangci-strict.yaml adds checks that all new code in pull requests
6-
# must pass.
75
# - golangci-hints.yaml adds checks for code patterns where developer
86
# and reviewer may decide whether findings should get addressed before
97
# merging. Beware that the golangci-lint output includes also the
@@ -171,11 +169,6 @@ linters:
171169
{{- if not .Base }}
172170
- usestdlibvars
173171
{{- end}}
174-
{{- if .Strict}}
175-
disable:
176-
# https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507008359
177-
- errcheck
178-
{{- end}}
179172

180173
linters-settings: # please keep this alphabetized
181174
custom:

hack/update-golangci-lint-config.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,4 @@ generate () {
4040

4141
# Regenerate.
4242
generate hack/golangci.yaml Base=1
43-
generate hack/golangci-strict.yaml Strict=1
4443
generate hack/golangci-hints.yaml Hints=1

hack/verify-golangci-lint.sh

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Usage: $0 [-r <revision>|-a] [-s] [-c none|<config>] [-- <golangci-lint run flag
2525
-r <revision>: only report issues in code added since that revision
2626
-a: automatically select the common base of origin/master and HEAD
2727
as revision
28-
-s: select a strict configuration for new code
2928
-n: in addition to strict checking, also enable hints (aka nits) that may or may not
3029
be useful
3130
-g <github action file>: also write results with --out-format=github-actions
@@ -53,7 +52,6 @@ invocation=(./hack/verify-golangci-lint.sh "$@")
5352
golangci=("${GOBIN}/golangci-lint" run)
5453
golangci_config="${KUBE_ROOT}/hack/golangci.yaml"
5554
base=
56-
strict=
5755
hints=
5856
githubactions=
5957
while getopts "ar:sng:c:" o; do
@@ -69,10 +67,6 @@ while getopts "ar:sng:c:" o; do
6967
usage
7068
fi
7169
;;
72-
s)
73-
golangci_config="${KUBE_ROOT}/hack/golangci-strict.yaml"
74-
strict=1
75-
;;
7670
n)
7771
golangci_config="${KUBE_ROOT}/hack/golangci-hints.yaml"
7872
hints=1
@@ -185,18 +179,12 @@ else
185179
echo "Please review the above warnings. You can test via \"${invocation[*]}\""
186180
echo 'If the above warnings do not make sense, you can exempt this warning with a comment'
187181
echo ' (if your reviewer is okay with it).'
188-
if [ "$strict" ]; then
189-
echo
190-
echo 'golangci-strict.yaml was used as configuration. Warnings must be fixed in'
191-
echo 'new or modified code.'
192-
elif [ "$hints" ]; then
182+
if [ "$hints" ]; then
193183
echo
194184
echo 'golangci-hints.yaml was used as configuration. Some of the reported issues may'
195185
echo 'have to be fixed while others can be ignored, depending on the circumstances'
196186
echo 'and/or personal preferences. To determine which issues have to be fixed, check'
197-
echo 'the report that uses golangci-strict.yaml (= pull-kubernetes-verify-lint).'
198-
fi
199-
if [ "$strict" ] || [ "$hints" ]; then
187+
echo 'the report that uses golangci.yaml (= pull-kubernetes-verify).'
200188
echo
201189
echo 'If you feel that this warns about issues that should be ignored by default,'
202190
echo 'then please discuss with your reviewer and propose'
@@ -208,12 +196,13 @@ else
208196
echo 'Instead, propose to fix certain linter issues in an issue first and'
209197
echo 'discuss there with maintainers. PRs are welcome if they address a real'
210198
echo 'problem, which then needs to be explained in the PR.'
199+
else
200+
echo
201+
echo 'In general please prefer to fix the error, we have already disabled specific lints'
202+
echo ' that the project chooses to ignore.'
203+
echo 'See: https://golangci-lint.run/usage/false-positives/'
211204
fi
212205
echo
213-
echo 'In general please prefer to fix the error, we have already disabled specific lints'
214-
echo ' that the project chooses to ignore.'
215-
echo 'See: https://golangci-lint.run/usage/false-positives/'
216-
echo
217206
} >&2
218207
exit 1
219208
fi

0 commit comments

Comments
 (0)