Skip to content

Commit 523907a

Browse files
authored
Merge pull request #3034 from oscr/add-recommended-revive-checks
🌱 golangci-lint: add recommended revive checks to linter-settings but d…
2 parents 52f1315 + d166ad6 commit 523907a

File tree

3 files changed

+43
-8
lines changed

3 files changed

+43
-8
lines changed

.golangci.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
run:
2+
deadline: 5m
3+
allow-parallel-runners: true
4+
15
issues:
26
# don't skip warning about doc comments
37
# don't exclude the default set of lint
@@ -13,8 +17,42 @@ linters-settings:
1317
enable=fieldalignment: true
1418
revive:
1519
rules:
16-
- name: if-return
17-
disabled: true
20+
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
21+
- name: blank-imports
22+
- name: context-as-argument
23+
- name: context-keys-type
24+
- name: dot-imports
25+
- name: error-return
26+
- name: error-strings
27+
- name: error-naming
28+
- name: exported
29+
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
30+
- name: if-return
31+
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
32+
- name: increment-decrement
33+
- name: var-naming
34+
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
35+
- name: var-declaration
36+
- name: package-comments
37+
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
38+
- name: range
39+
- name: receiver-naming
40+
- name: time-naming
41+
- name: unexported-return
42+
- name: indent-error-flow
43+
- name: errorf
44+
- name: empty-block
45+
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
46+
- name: superfluous-else
47+
- name: unused-parameter
48+
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
49+
- name: unreachable-code
50+
- name: redefines-builtin-id
51+
#
52+
# Rules in addition to the recommended configuration above.
53+
#
54+
- name: bool-literal-in-expr
55+
- name: constant-logical-expr
1856

1957
linters:
2058
disable-all: true
@@ -40,6 +78,3 @@ linters:
4078
- unconvert
4179
- unparam
4280
- unused
43-
44-
run:
45-
deadline: 5m

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
8383
golangci-lint:
8484
@[ -f $(GOLANGCI_LINT) ] || { \
8585
set -e ;\
86-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.49.0 ;\
86+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.51.1 ;\
8787
}
8888

8989
.PHONY: apidiff

test/e2e/utils/test_context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ func (t *TestContext) LoadImageToKindCluster() error {
270270
}
271271

272272
// LoadImageToKindClusterWithName loads a local docker image with the name informed to the kind cluster
273-
func (tc TestContext) LoadImageToKindClusterWithName(image string) error {
273+
func (t TestContext) LoadImageToKindClusterWithName(image string) error {
274274
cluster := "kind"
275275
if v, ok := os.LookupEnv("KIND_CLUSTER"); ok {
276276
cluster = v
277277
}
278278
kindOptions := []string{"load", "docker-image", "--name", cluster, image}
279279
cmd := exec.Command("kind", kindOptions...)
280-
_, err := tc.Run(cmd)
280+
_, err := t.Run(cmd)
281281
return err
282282
}
283283

0 commit comments

Comments
 (0)