Skip to content

Commit 6a3fbac

Browse files
committed
chore: Explicitly list all enabled linters
1 parent 6eeeac2 commit 6a3fbac

7 files changed

+37
-86
lines changed

.golangci.yml

+30-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1-
issues:
2-
exclude-rules:
3-
- path: pkg/kubefedctl/enable/enable.go
4-
linters:
5-
- unused
6-
- structcheck
7-
- path: pkg/kubefedctl/join.go
8-
linters:
9-
- structcheck
10-
- path: pkg/kubefedctl/disable.go
11-
linters:
12-
- structcheck
1+
run:
2+
timeout: 5m
3+
skip-dirs:
4+
- third-party
5+
6+
linters:
7+
disable-all: true
8+
enable:
9+
- deadcode
10+
- errcheck
11+
- goconst
12+
- gocritic
13+
- goimports
14+
- gosimple
15+
- govet
16+
- ineffassign
17+
- nolintlint
18+
- prealloc
19+
- staticcheck
20+
- structcheck
21+
- stylecheck
22+
- typecheck
23+
- unparam
24+
- unused
25+
- varcheck
26+
- whitespace
27+
28+
linters-settings:
29+
goimports:
30+
local-prefixes: sigs.k8s.io/kubefed

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ TEST = $(TEST_CMD) $(TEST_PKGS)
6767
DOCKER_BUILD ?= $(DOCKER) run -it --rm -v $(DIR):$(BUILDMNT) -w $(BUILDMNT) $(BUILD_IMAGE) /bin/sh -c
6868

6969
# TODO (irfanurrehman): can add local compile, and auto-generate targets also if needed
70-
.PHONY: all container push clean hyperfed controller kubefedctl test local-test vet fmt build bindir generate webhook e2e deploy.kind
70+
.PHONY: all container push clean hyperfed controller kubefedctl test local-test vet lint build bindir generate webhook e2e deploy.kind
7171

7272
all: container hyperfed controller kubefedctl webhook e2e
7373

@@ -80,8 +80,8 @@ build: hyperfed controller kubefedctl webhook
8080
vet:
8181
go vet $(TEST_PKGS)
8282

83-
fmt:
84-
$(shell ./hack/update-gofmt.sh)
83+
lint:
84+
golangci-lint run -c .golangci.yml --fix
8585

8686
container: $(HYPERFED_TARGET)-linux-$(HOST_ARCH)
8787
cp -f $(HYPERFED_TARGET)-linux-$(HOST_ARCH) images/kubefed/hyperfed

hack/go-tools/verify-gofmt.sh

-41
This file was deleted.

hack/update-gofmt.sh

-25
This file was deleted.

scripts/download-binaries.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ curl "${curl_args}O" "${helm_url}" \
6060
&& tar xzfp "${helm_tgz}" -C "${dest_dir}" --strip-components=1 "${platform}-amd64/helm" \
6161
&& rm "${helm_tgz}"
6262

63-
golint_version="1.27.0"
63+
golint_version="1.30.0"
6464
golint_dir="golangci-lint-${golint_version}-${platform}-amd64"
6565
golint_tgz="${golint_dir}.tar.gz"
6666
golint_url="https://github.com/golangci/golangci-lint/releases/download/v${golint_version}/${golint_tgz}"

scripts/pre-commit.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,12 @@ download-dependencies
120120
echo "Checking initial state of working tree"
121121
check-git-state
122122

123-
echo "Verifying Gofmt"
124-
./hack/go-tools/verify-gofmt.sh
125-
126123
echo "Checking boilerplate text"
127124
./third-party/k8s.io/repo-infra/hack/verify_boilerplate.py --rootdir="${ROOT_DIR}"
128125

129126
echo "Linting"
130-
golangci-lint run --timeout=5m
127+
golangci-lint run -c .golangci.yml --fix
128+
check-git-state
131129

132130
echo "Checking that correct Error Package is used."
133131
./hack/verify-errpkg.sh

staticcheck.conf

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
checks = ["all"]

0 commit comments

Comments
 (0)