diff --git a/.golangci.yml b/.golangci.yml index 4ed0099db..6a9794532 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,18 +1,36 @@ -run: - timeout: 5m - +version: "2" linters: - disable-all: true + default: none + enable: + - gocyclo + - govet + - misspell + # - staticcheck // TODO: enable later once the code is properly updated + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: enable: - gofmt - gofumpt - - gosimple - - gocyclo - - misspell - - govet - -linters-settings: - gofumpt: - extra-rules: true - goimports: - local-prefixes: sigs.k8s.io/descheduler + #- goimports // TODO: enable later once the code is properly updated + settings: + gofumpt: + extra-rules: true + goimports: + local-prefixes: + - sigs.k8s.io/descheduler + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index 252460970..e958d1954 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ ARCHS = amd64 arm arm64 LDFLAGS=-ldflags "-X ${LDFLAG_LOCATION}.version=${VERSION} -X ${LDFLAG_LOCATION}.buildDate=${BUILD} -X ${LDFLAG_LOCATION}.gitbranch=${BRANCH} -X ${LDFLAG_LOCATION}.gitsha1=${SHA1}" -GOLANGCI_VERSION := v1.64.8 +GOLANGCI_VERSION := v2.8.0 HAS_GOLANGCI := $(shell ls _output/bin/golangci-lint 2> /dev/null) GOFUMPT_VERSION := v0.7.0 @@ -149,12 +149,14 @@ ifndef HAS_GOLANGCI curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./_output/bin ${GOLANGCI_VERSION} endif ./_output/bin/golangci-lint run -v + ./_output/bin/golangci-lint fmt -v fmt: ifndef HAS_GOFUMPT go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} endif gofumpt -w -extra . + goimports -w pkg metrics test # helm