Skip to content

Commit

Permalink
Merge pull request #3034 from oscr/add-recommended-revive-checks
Browse files Browse the repository at this point in the history
🌱  golangci-lint: add recommended revive checks to linter-settings but d…
  • Loading branch information
k8s-ci-robot committed Oct 24, 2022
2 parents 52f1315 + d166ad6 commit 523907a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
45 changes: 40 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
run:
deadline: 5m
allow-parallel-runners: true

issues:
# don't skip warning about doc comments
# don't exclude the default set of lint
Expand All @@ -13,8 +17,42 @@ linters-settings:
enable=fieldalignment: true
revive:
rules:
- name: if-return
disabled: true
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
- name: if-return
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
- name: increment-decrement
- name: var-naming
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
- name: var-declaration
- name: package-comments
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
- name: superfluous-else
- name: unused-parameter
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
- name: unreachable-code
- name: redefines-builtin-id
#
# Rules in addition to the recommended configuration above.
#
- name: bool-literal-in-expr
- name: constant-logical-expr

linters:
disable-all: true
Expand All @@ -40,6 +78,3 @@ linters:
- unconvert
- unparam
- unused

run:
deadline: 5m
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
golangci-lint:
@[ -f $(GOLANGCI_LINT) ] || { \
set -e ;\
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.49.0 ;\
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.51.1 ;\
}

.PHONY: apidiff
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/utils/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ func (t *TestContext) LoadImageToKindCluster() error {
}

// LoadImageToKindClusterWithName loads a local docker image with the name informed to the kind cluster
func (tc TestContext) LoadImageToKindClusterWithName(image string) error {
func (t TestContext) LoadImageToKindClusterWithName(image string) error {
cluster := "kind"
if v, ok := os.LookupEnv("KIND_CLUSTER"); ok {
cluster = v
}
kindOptions := []string{"load", "docker-image", "--name", cluster, image}
cmd := exec.Command("kind", kindOptions...)
_, err := tc.Run(cmd)
_, err := t.Run(cmd)
return err
}

Expand Down

0 comments on commit 523907a

Please sign in to comment.